webapp-deployment-status-api/__tests__/main.test.ts
2024-02-15 13:55:48 -06:00

23 lines
556 B
TypeScript

describe('greeter function', () => {
let timeoutSpy: jest.SpyInstance;
// Act before assertions
beforeAll(async () => {
timeoutSpy = jest.spyOn(global, 'setTimeout');
//const p: Promise<string> = greeter(name);
jest.runOnlyPendingTimers();
});
// Teardown (cleanup) after assertions
afterAll(() => {
timeoutSpy.mockRestore();
});
// Assert if setTimeout was called properly
it('delays the greeting by 2 seconds', () => {});
// Assert greeter result
it('greets a user with `Hello, {name}` message', () => {});
});