diff --git a/e2e/tests/generation-live.spec.ts b/e2e/tests/generation-live.spec.ts index 1a0e154..49bb686 100644 --- a/e2e/tests/generation-live.spec.ts +++ b/e2e/tests/generation-live.spec.ts @@ -268,5 +268,24 @@ test.describe('Live generation with OpenAI', () => { // Some sites block HEAD requests — skip rather than fail } } + + // ═══════════════════════════════════════════════════════════════ + // Provenance verification + // ═══════════════════════════════════════════════════════════════ + const provResp = await apiCall(page, 'GET', `/api/v1/syntheses/${synthesisId}/provenance`); + expect(provResp.status).toBe(200); + const provenance = provResp.data; + expect(Array.isArray(provenance)).toBe(true); + expect(provenance.length).toBeGreaterThan(0); + + // At least some entries should be 'used' + const usedEntries = provenance.filter((e: any) => e.status === 'used'); + expect(usedEntries.length).toBeGreaterThan(0); + + // Every used entry should have a synthesis_id matching this synthesis + for (const entry of usedEntries) { + expect(entry.synthesis_id).toBe(synthesisId); + expect(entry.job_id).toBeTruthy(); + } }); });