( received: Record<string, unknown>[], pred: (f: Record<string, unknown>) => boolean, timeoutMs = 2000, )
| 156 | } |
| 157 | |
| 158 | async function waitFor( |
| 159 | received: Record<string, unknown>[], |
| 160 | pred: (f: Record<string, unknown>) => boolean, |
| 161 | timeoutMs = 2000, |
| 162 | ): Promise<Record<string, unknown>> { |
| 163 | const start = Date.now(); |
| 164 | while (Date.now() - start < timeoutMs) { |
| 165 | const found = received.find(pred); |
| 166 | if (found !== undefined) return found; |
| 167 | await new Promise((resolve) => setTimeout(resolve, 10)); |
| 168 | } |
| 169 | throw new Error(`timed out waiting for frame; got ${JSON.stringify(received)}`); |
| 170 | } |
| 171 | |
| 172 | describe('POST /api/v1/sessions — create', () => { |
| 173 | it('returns a Session payload with snake_case + ISO Z timestamps', async () => { |
no test coverage detected