mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
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.
This commit is contained in:
1 parent
d6bb7bc905
commit
a57d2ffe83
1 file changed
+18
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user