Skip to content

Commit

Permalink
fix: all act warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Dec 19, 2023
1 parent 1d81109 commit e6afa31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/use-swr-local-mutation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})

Expand Down Expand Up @@ -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'])
})

Expand All @@ -1079,7 +1081,7 @@ describe('useSWR - local mutation', () => {
optimisticData: data => 'function_' + data
})
)
await sleep(30)
await act(() => sleep(30))
expect(renderedData).toEqual([
undefined,
'foo',
Expand Down

0 comments on commit e6afa31

Please sign in to comment.