From a57d2ffe83c992f9e9825df418a7ec612f8ebfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 25 Oct 2026 11:46:51 +0100 Subject: [PATCH] test(fhir): pin the search parameters the CapabilityStatement declares The statement already declares `date` and `code` on Observation beside paging on every search; the route test now asserts that list per resource, so a parameter the search honours cannot drop out of it unnoticed. --- tests/integration/routes/fhir.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/integration/routes/fhir.test.ts b/tests/integration/routes/fhir.test.ts index a094784b8..8ff64fff2 100644 --- a/tests/integration/routes/fhir.test.ts +++ b/tests/integration/routes/fhir.test.ts @@ -313,6 +313,9 @@ describe("GET /api/fhir/metadata", () => { z.looseObject({ type: z.string(), interaction: z.array(z.object({ code: z.string() })), + searchParam: z.array( + z.object({ name: z.string(), type: z.string() }), + ), operation: z.array(z.object({ name: z.string() })).optional(), }), ), @@ -330,6 +333,21 @@ describe("GET /api/fhir/metadata", () => { expect(patient).toHaveLength(1); expect(patient[0].operation?.map((o) => o.name)).toEqual(["everything"]); + // Paging on every search; the Observation search alone honours the + // time-series range and the code filter, and says so. + for (const resource of resources) { + expect(resource.searchParam, resource.type).toEqual([ + { name: "_count", type: "number" }, + { name: "_offset", type: "number" }, + ...(resource.type === "Observation" + ? [ + { name: "date", type: "date" }, + { name: "code", type: "token" }, + ] + : []), + ]); + } + const root = path.join(process.cwd(), "src/app/api/fhir"); for (const resource of resources) { for (const { code } of resource.interaction) {