Skip to content

Commit b2db128

Browse files
huozhinevilm-lt
authored andcommitted
test: add delay for flaky focus test (vercel#1762)
1 parent ba9a4a0 commit b2db128

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/use-swr-focus.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ describe('useSWR - focus', () => {
195195
await focusWindow()
196196
// wait for throttle intervals
197197
await act(() => sleep(150))
198-
await screen.findByText('data: 4')
198+
// trigger revalidation
199+
await focusWindow()
200+
await waitForNextTick()
201+
await act(() => sleep(100))
202+
await screen.findByText('data: 5')
199203
})
200204

201205
it('should revalidate on focus even with custom cache', async () => {

0 commit comments

Comments
 (0)