From e6afa310d83e32e71b1e41912174be00c20e886e Mon Sep 17 00:00:00 2001 From: Toru Kobayashi Date: Tue, 19 Dec 2023 16:58:21 +0900 Subject: [PATCH] fix: all act warnings --- test/use-swr-local-mutation.test.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/use-swr-local-mutation.test.tsx b/test/use-swr-local-mutation.test.tsx index 747404071..60a14f4f6 100644 --- a/test/use-swr-local-mutation.test.tsx +++ b/test/use-swr-local-mutation.test.tsx @@ -564,7 +564,9 @@ describe('useSWR - local mutation', () => { // Mount await screen.findByText('error') - mutate(v => v, { revalidate: false }) + act(() => { + mutate(v => v, { revalidate: false }) + }) await screen.findByText('data: undefined') }) @@ -1053,7 +1055,7 @@ describe('useSWR - local mutation', () => { optimisticData: 'bar' }) ) - await sleep(30) + await act(() => sleep(30)) expect(renderedData).toEqual([undefined, 'foo', 'bar', 'baz', 'foo']) }) @@ -1079,7 +1081,7 @@ describe('useSWR - local mutation', () => { optimisticData: data => 'function_' + data }) ) - await sleep(30) + await act(() => sleep(30)) expect(renderedData).toEqual([ undefined, 'foo',