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) {