Enfoce high jest code coverage

This commit is contained in:
Charles Bochet
2024-02-09 15:14:39 +01:00
parent cca72da708
commit 66adbb1783
11 changed files with 66 additions and 36 deletions

View File

@ -1,20 +0,0 @@
import { debounce } from '../debounce';
describe('debounce', () => {
it('should debounce a function', () => {
jest.useFakeTimers();
const func = jest.fn();
const debouncedFunc = debounce(func, 1000);
debouncedFunc();
debouncedFunc();
debouncedFunc();
expect(func).not.toHaveBeenCalled();
jest.runAllTimers();
expect(func).toHaveBeenCalledTimes(1);
});
});