(description, testFn)
| 57 | } |
| 58 | |
| 59 | async function test(description, testFn) { |
| 60 | totalTests++; |
| 61 | try { |
| 62 | const result = await testFn(); |
| 63 | if (result === true || result === undefined) { |
| 64 | log(`✅ ${description}`, 'success'); |
| 65 | passedTests++; |
| 66 | } else { |
| 67 | log(`❌ ${description}: ${result}`, 'error'); |
| 68 | failedTests++; |
| 69 | } |
| 70 | } catch (error) { |
| 71 | log(`❌ ${description}: ${error.message}`, 'error'); |
| 72 | if (error.errors) { |
| 73 | console.error('Validation errors:', JSON.stringify(error.errors, null, 2)); |
| 74 | } |
| 75 | failedTests++; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | // Cache for compiled schemas |
| 80 | const schemaCache = new Map(); |
no test coverage detected