Skip to content

Commit 387386d

Browse files
committed
do not use sleep to wait for garbage collection
setTimeout is not reliable, so it's better to avoid it
1 parent 5f27784 commit 387386d

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/tests/useQuery.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,8 @@ describe('useQuery', () => {
263263

264264
expect(Object.keys(queryCache.queries).length).toEqual(5)
265265

266-
// wait for garbage collection
267-
await sleep(0)
266+
await waitForElement(() => rendered.getByText('todo aaaa'))
268267

269268
expect(Object.keys(queryCache.queries).length).toEqual(1)
270-
271-
await waitForElement(() => rendered.getByText('todo aaaa'))
272269
})
273270
})

0 commit comments

Comments
 (0)