Skip to content

Commit

Permalink
Merge pull request #872 from makenowjust-labs/check-sync-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust committed May 1, 2023
2 parents cdc9364 + 3cd1173 commit 678746c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/recheck/src/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as synckit from "synckit";

import * as main from "./main";

import * as env from "./lib/env";
Expand All @@ -9,6 +11,7 @@ const RECHECK_BIN = `${__dirname}/../../../modules/recheck-cli/target/native-ima

jest.setTimeout(10000);

jest.mock("synckit");
jest.mock("./lib/env");
jest.mock("./lib/java");
jest.mock("./lib/native");
Expand Down Expand Up @@ -144,9 +147,12 @@ test("check: invalid", async () => {
test("checkSync: synckit", () => {
const backend = jest.spyOn(env, "RECHECK_SYNC_BACKEND");
backend.mockReturnValueOnce("synckit" as any);
const createSyncFn = jest.spyOn(synckit, "createSyncFn");
createSyncFn.mockReturnValueOnce(() => ({ status: "vulnerable" }));

const diagnostics = main.checkSync("^(a|a)+$", "");
expect(diagnostics.status).toBe("vulnerable");
expect(createSyncFn).toHaveBeenCalled();
});

test("checkSync: pure", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/recheck/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const checkSync = (
syncFnCache = createSyncFn(require.resolve("./synckit-worker"));
}
syncFn = syncFnCache;
break;
case "pure":
syncFn = pure.check;
break;
Expand Down

0 comments on commit 678746c

Please sign in to comment.