aupl-ss24-sudoku-solver/index.test.ts
Technical University Darmstadt Germany c8019d04cd Initial commit
2024-06-06 12:28:40 +02:00

27 lines
718 B
TypeScript

import { randomUUID } from "crypto";
jest.spyOn(console, "log");
jest.mock("typeorm");
describe("index", () => {
beforeEach(() => {
jest.clearAllMocks();
process.env["DB_HOST"] = randomUUID();
process.env["DB_USER"] = randomUUID();
process.env["DB_PASS"] = randomUUID();
process.env["DB_NAME"] = randomUUID();
});
it("should log hello world", async () => {
(console.log as jest.MockedFn<typeof console.log>).mockImplementation(() => {
return;
});
await (await import("./index")).default;
expect(console.log).toHaveBeenCalledTimes(1);
expect(console.log).toHaveBeenLastCalledWith("Hello world!");
});
});