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',