Skip to content

Commit

Permalink
Add test for toast dismissal without container
Browse files Browse the repository at this point in the history
  • Loading branch information
trylle authored and fkhadra committed Aug 7, 2022
1 parent 831eff2 commit a6936e3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/core/toast.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ describe('toastify', () => {
expect(screen.queryByText('hello')).toBe(null);
});

it('Should be able remove toast programmatically without container', () => {
let id: Id;
act(() => {
id = toast('hello');
jest.runAllTimers();
toast.dismiss(id);
jest.runAllTimers();
});
render(<ToastContainer />);

act(() => {
jest.runAllTimers();
});

expect(screen.queryByText('hello')).toBe(null);
});

describe('update function', () => {
it('Should be able to update an existing toast', () => {
render(<ToastContainer />);
Expand Down

0 comments on commit a6936e3

Please sign in to comment.