Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Dec 20, 2023
1 parent 3e1cbea commit 34bc89c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/std/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { right } from "fp-ts/Separated";

Check failure on line 1 in src/std/index.test.ts

View workflow job for this annotation

GitHub Actions / build

'right' is defined but never used
import { E, parseFunctionBody, pipe, trySchemas } from "./index";
import { string, number, array, boolean, object } from "valibot";

Expand Down Expand Up @@ -116,7 +117,7 @@ describe("parseFunctionBody", () => {
result,
E.match(
(err) => fail("Expected a right"),
(result) => expect(result.toString()).toMatch(input),
(result) => expect(result).toBeInstanceOf(Function),
),
);
});
Expand All @@ -125,16 +126,15 @@ describe("parseFunctionBody", () => {
const result = parseFunctionBody(input);
expect(result).toEqual(E.left(new SyntaxError("Unexpected token ')'")));
});
it("should parse a function body with arguments", () => {
it("should parse a function body with arguments and be able to execute it", () => {
const input = "return x + 1;";
const result = parseFunctionBody<[number], number>(input, "x");
pipe(
result,
E.match(
() => fail("Expected a right"),
(result) => {
expect(result.toString()).toMatch(input);
expect(result(1)).toEqual(2);
expect(result(1)).toEqual(E.right(2));
},
),
);
Expand Down

0 comments on commit 34bc89c

Please sign in to comment.