| 49 | const results: TestResult[] = []; |
| 50 | |
| 51 | async function runTest(name: string, fn: () => Promise<void>): Promise<void> { |
| 52 | const start = Date.now(); |
| 53 | try { |
| 54 | await fn(); |
| 55 | results.push({ name, passed: true, durationMs: Date.now() - start }); |
| 56 | console.log(` ✓ PASS (${Date.now() - start}ms): ${name}`); |
| 57 | } catch (e) { |
| 58 | results.push({ name, passed: false, error: String(e), durationMs: Date.now() - start }); |
| 59 | console.log(` ✗ FAIL (${Date.now() - start}ms): ${name}`); |
| 60 | console.log(` Error: ${e}`); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // ============================================================================ |
| 65 | // Tests |