aupl-ss24-sudoku-solver/index.test.ts

27 lines
718 B
TypeScript
Raw Normal View History

2024-06-06 12:28:40 +02:00
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!");
});
});