Skip to content

Commit

Permalink
fix: tests unhandled promise rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
fshovchko committed Dec 26, 2021
1 parent 3db7e31 commit d6ca55a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/esl-utils/async/test/debounce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ describe('async/debounce', () => {
test('cancel debounce', () => {
const fn = jest.fn();
const debounced = debounce(fn, 10);
const promise = debounced.promise;
debounced();
debounced.cancel();

setTimeout(() => debounced.cancel());
const promise = debounced.promise;
jest.runAllTimers();
return promise.catch(() => expect(fn).toBeCalledTimes(0));
}, 100);
});

test('deferred result', () => {
const fn = jest.fn((n) => n + 1);
Expand Down

0 comments on commit d6ca55a

Please sign in to comment.