Skip to content

Commit

Permalink
fixup! fixup! Feat(web-react): Add autoclose feature to Toast component
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelklibani committed May 18, 2024
1 parent 384b3f1 commit 8718bcc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/web-react/src/utils/__tests__/delayedCallback.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { delayedCallback } from '../delayedCallback';

describe('delayedCallback', () => {
it('should call the callback after the specified interval', () => {
jest.useFakeTimers();

const callback = jest.fn();
const interval = 1000; // 1 second

delayedCallback(callback, interval);

expect(callback).not.toHaveBeenCalled();

jest.runAllTimers();

expect(callback).toHaveBeenCalled();
});
});

0 comments on commit 8718bcc

Please sign in to comment.