From a6936e35041284e1acb5bca69b2aa9a666c7e771 Mon Sep 17 00:00:00 2001 From: Frits Talbot Date: Wed, 3 Aug 2022 22:49:16 +0200 Subject: [PATCH] Add test for toast dismissal without container --- test/core/toast.test.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/core/toast.test.tsx b/test/core/toast.test.tsx index c531e6b1..6f0ab0aa 100644 --- a/test/core/toast.test.tsx +++ b/test/core/toast.test.tsx @@ -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(); + + act(() => { + jest.runAllTimers(); + }); + + expect(screen.queryByText('hello')).toBe(null); + }); + describe('update function', () => { it('Should be able to update an existing toast', () => { render();