mirror of
https://github.com/nick-fields/retry.git
synced 2026-02-10 15:15:30 +00:00
* test: move timeout tests to their own job to speed things up slightly * test: add comment about timeout tests * test: fix needs in cd job * test: add jest configuration and first test * test: setup codecov to track coverage
18 lines
459 B
TypeScript
18 lines
459 B
TypeScript
import 'jest';
|
|
import { getHeapStatistics } from 'v8';
|
|
|
|
import { wait } from './util';
|
|
|
|
// mocks the setTimeout function, see https://jestjs.io/docs/timer-mocks
|
|
jest.useFakeTimers();
|
|
jest.spyOn(global, 'setTimeout');
|
|
|
|
describe('util', () => {
|
|
test('wait', async () => {
|
|
const waitTime = 1000;
|
|
wait(waitTime);
|
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), waitTime);
|
|
});
|
|
});
|