(fn: () => void, timeout = 2000, interval = 20)
| 84 | |
| 85 | // Helper function to poll for a condition until it passes or times out |
| 86 | async function waitFor(fn: () => void, timeout = 2000, interval = 20) { |
| 87 | const start = Date.now() |
| 88 | |
| 89 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
| 90 | while (true) { |
| 91 | try { |
| 92 | fn() |
| 93 | return |
| 94 | } catch (err) { |
| 95 | if (Date.now() - start > timeout) throw err |
| 96 | await new Promise((resolve) => setTimeout(resolve, interval)) |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | describe(`Query Collections`, () => { |
| 102 | it(`should work with basic collection and select`, async () => { |
no test coverage detected