webapp-deployment-status-api/__tests__/main.test.ts

23 lines
556 B
TypeScript
Raw Normal View History

2024-01-19 02:17:30 +00:00
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
2024-02-15 19:55:48 +00:00
it('delays the greeting by 2 seconds', () => {});
2024-01-19 02:17:30 +00:00
// Assert greeter result
2024-02-15 19:55:48 +00:00
it('greets a user with `Hello, {name}` message', () => {});
2024-01-19 02:17:30 +00:00
});