Skip to content

Commit

Permalink
test: array test for Evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
yazaldefilimone committed Feb 25, 2024
1 parent 890724a commit 396c20e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/evaluator/tests/array.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { it, expect, describe } from "vitest";
import { makeSut } from "./sut";
import { InternalArray, Integer } from "evaluator/object";

describe("Evaluator", () => {
describe("Array", () => {
it("should create array", () => {
const arrayTest = [1, 2, 3];
const tt = {
input: `
let myArray = [${arrayTest.join(", ")}];
myArray;
`,
expected: new InternalArray(arrayTest.map((num) => new Integer(num))),
};
const sut = makeSut(tt.input);
expect(sut).not.toBeNull();
expect(sut?.value).toEqual(tt.expected.value);
});
});
});

0 comments on commit 396c20e

Please sign in to comment.