From 45f3d410a767a5d8804ff01be339c2e69eef4b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 23 Sep 2026 04:33:38 +0300 Subject: [PATCH] =?UTF-8?q?test:=20=F0=9F=A4=9D=20align=20the=20ai=20contr?= =?UTF-8?q?act=20assertions=20with=20the=20documented=20receipts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /insights/refresh 202 carries {status: "accepted"} only — the run's record is ZEKA's, no message row id is minted - POST /podcast/jobs for an unnarratable source is the documented 409 source_missing, not a 404 --- src/api/__tests__/contract/ai.contract.test.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/__tests__/contract/ai.contract.test.ts b/src/api/__tests__/contract/ai.contract.test.ts index d8649f3..8386467 100644 --- a/src/api/__tests__/contract/ai.contract.test.ts +++ b/src/api/__tests__/contract/ai.contract.test.ts @@ -42,9 +42,10 @@ describe.skipIf(!isLive)(`ai contract @ ${contractBaseUrl}`, () => { const response = await api("/insights/refresh", { method: "POST", body: {} }); expect([202, 503]).toContain(response.status); if (response.status === 202) { + // Documented receipt is `{status: "accepted"}` only: the work's own + // record is ZEKA's (zeka_run), so no message row id is minted here. const receipt = (await response.json()) as Record; - expect(typeof receipt.message_id).toBe("string"); - expect(receipt.status).toBe("pending"); + expect(receipt.status).toBe("accepted"); } }); @@ -53,9 +54,11 @@ describe.skipIf(!isLive)(`ai contract @ ${contractBaseUrl}`, () => { method: "POST", body: { source_id: "00000000-0000-0000-0000-000000000000" }, }); - // 503 with no service, 400/404 for the missing course note once there is - // one. A 202 here would mean the backend minted a job for nothing. - expect([400, 404, 503]).toContain(response.status); + // 503 with no service, 400/404 for a malformed or unresolvable id, and the + // backend's documented 409 `source_missing` when the note has no narratable + // PDF on this host (a nonexistent note lands there too, by design). A 202 + // here would mean the backend minted a job for nothing. + expect([400, 404, 409, 503]).toContain(response.status); }); it("answers nothing for an audio job id that is not the caller's", async () => {