From 1e89efebaedf42d62bd325e308d16adbadf74189 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 5 Jan 2023 17:45:48 -0600 Subject: [PATCH] Tests: wrap toast.remove() with act() --- app/soapbox/jest/test-setup.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/soapbox/jest/test-setup.ts b/app/soapbox/jest/test-setup.ts index dc27e9a89..d4d16859b 100644 --- a/app/soapbox/jest/test-setup.ts +++ b/app/soapbox/jest/test-setup.ts @@ -1,5 +1,6 @@ 'use strict'; +import { act } from '@testing-library/react'; import { toast } from 'react-hot-toast'; import { __clear as clearApiMocks } from '../api/__mocks__'; @@ -17,7 +18,9 @@ require('fake-indexeddb/auto'); // Clear toasts after each test. afterEach(() => { - toast.remove(); + act(() => { + toast.remove(); + }); }); const intersectionObserverMock = () => ({ observe: () => null, disconnect: () => null });