(predicate: () => boolean, timeoutMs = 100)
| 16 | } |
| 17 | |
| 18 | async function waitUntil(predicate: () => boolean, timeoutMs = 100): Promise<void> { |
| 19 | const started = Date.now() |
| 20 | while (!predicate()) { |
| 21 | if (Date.now() - started > timeoutMs) { |
| 22 | throw new Error('Timed out waiting for condition') |
| 23 | } |
| 24 | await Bun.sleep(1) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | describe('jwtUtils', () => { |
| 29 | it('decodes JWT payloads and expiry, including session-ingress prefixed tokens', () => { |