18 lines
452 B
TypeScript
18 lines
452 B
TypeScript
|
jest.spyOn(console, "log");
|
||
|
|
||
|
describe("index", () => {
|
||
|
beforeEach(() => {
|
||
|
jest.clearAllMocks();
|
||
|
});
|
||
|
|
||
|
it("should log hello world", async () => {
|
||
|
(console.log as jest.MockedFn<typeof console.log>).mockImplementation(() => {
|
||
|
return;
|
||
|
});
|
||
|
await import("./index");
|
||
|
|
||
|
expect(console.log).toHaveBeenCalledTimes(1);
|
||
|
expect(console.log).toHaveBeenLastCalledWith("Hello world!");
|
||
|
});
|
||
|
});
|