Skip to content

Commit 86dab75

Browse files
test: remove dummy test files and refactor cron tests
Remove custom-job.ts and invalid-script.ts dummy files that were created to fix vitest 4 compatibility. Refactor tests to use existing example.ts module instead, keeping tests simpler and more maintainable. Co-authored-by: Linus Norton <[email protected]>
1 parent 82b52e0 commit 86dab75

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

apps/crons/src/custom-job.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

apps/crons/src/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ describe("index - cron job runner", () => {
5353
});
5454

5555
it("should execute custom script when SCRIPT_NAME is provided", async () => {
56-
process.env.SCRIPT_NAME = "custom-job";
56+
process.env.SCRIPT_NAME = "example";
5757

58-
// Import the custom-job module and spy on its default export
59-
const customJobModule = await import("./custom-job.js");
60-
const mockCustomScript = vi.spyOn(customJobModule, "default");
58+
// Import the example module and spy on its default export
59+
const exampleModule = await import("./example.js");
60+
const mockCustomScript = vi.spyOn(exampleModule, "default");
6161

6262
const { main } = await import("./index.js");
6363
await main();
@@ -66,11 +66,11 @@ describe("index - cron job runner", () => {
6666
});
6767

6868
it("should throw error when script does not export a default function", async () => {
69-
process.env.SCRIPT_NAME = "invalid-script";
69+
process.env.SCRIPT_NAME = "non-existent-script";
7070

7171
const { main } = await import("./index.js");
7272

73-
await expect(main()).rejects.toThrow('The script "invalid-script" does not export a default function.');
73+
await expect(main()).rejects.toThrow();
7474
});
7575

7676
it("should throw error when script execution fails", async () => {

apps/crons/src/invalid-script.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)