| 58 | } |
| 59 | |
| 60 | async function testAnalyticsSink() { |
| 61 | console.log('\n--- Analytics Sink ---') |
| 62 | try { |
| 63 | const analytics = await import('../src/services/analytics/index.js') |
| 64 | |
| 65 | // logEvent should queue without crashing when no sink is attached |
| 66 | analytics.logEvent('test_event', { test_key: 1 }) |
| 67 | pass('logEvent (no sink)', 'queues without crash') |
| 68 | |
| 69 | await analytics.logEventAsync('test_async_event', { test_key: 2 }) |
| 70 | pass('logEventAsync (no sink)', 'queues without crash') |
| 71 | } catch (err: any) { |
| 72 | fail('Analytics sink', err.message) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | async function testPolicyLimits() { |
| 77 | console.log('\n--- Policy Limits ---') |