Skip to content

Commit 65ab804

Browse files
committed
test(react/vanilla-utils/loadable): restore 10ms delay with fake timer for infinite loop test (#1481)
1 parent 363e28a commit 65ab804

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/react/vanilla-utils/loadable.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ it('loadable of a derived async atom with error does not trigger infinite loop (
262262
expect(screen.getByText('Error: thrown in baseAtom')).toBeInTheDocument()
263263
})
264264

265-
it('does not repeatedly attempt to get the value of an unresolved promise atom wrapped in a loadable (#1481)', () => {
265+
it('does not repeatedly attempt to get the value of an unresolved promise atom wrapped in a loadable (#1481)', async () => {
266266
const baseAtom = atom(new Promise<number>(() => {}))
267267

268268
let callsToGetBaseAtom = 0
@@ -277,6 +277,8 @@ it('does not repeatedly attempt to get the value of an unresolved promise atom w
277277
</StrictMode>,
278278
)
279279

280+
// we need a small delay to reproduce the issue
281+
await act(() => vi.advanceTimersByTimeAsync(10))
280282
// depending on provider-less mode or versioned-write mode, there will be
281283
// either 2 or 3 calls.
282284
expect(callsToGetBaseAtom).toBeLessThanOrEqual(3)

0 commit comments

Comments
 (0)