diff --git a/tests/integration/contract-seed.ts b/tests/integration/contract-seed.ts index c297e90c2..a08484fd2 100644 --- a/tests/integration/contract-seed.ts +++ b/tests/integration/contract-seed.ts @@ -255,6 +255,19 @@ export async function seedContractAccount( : {}), })), }); + // A second source for the steps on the last week, so the provenance reads + // explain a pick between two sources and the comparison has a pair. + await prisma.measurement.createMany({ + data: [1, 2, 3, 4, 5, 6, 7].map((n) => ({ + userId: CONTRACT_USER_ID, + type: "ACTIVITY_STEPS" as const, + value: 6500 + ((n * 613) % 4000), + unit: "count", + measuredAt: daysAgo(n, 21), + source: "APPLE_HEALTH" as const, + externalId: `contract-steps-watch-${n}`, + })), + }); const firstMeasurement = await prisma.measurement.findFirst({ where: { userId: CONTRACT_USER_ID, type: "WEIGHT" }, orderBy: { measuredAt: "desc" }, @@ -790,6 +803,22 @@ export async function seedContractAccount( { id: ids.lab }, ); } + // A saved manual order for the labs list, so the layout read carries an + // order with an id in it. + if (ids.lab) { + await write( + "module-list-layout", + "PUT", + "api/settings/module-list-layout", + { + version: 1, + list: "labs", + view: "list", + order: [ids.lab], + sortDir: "manual", + }, + ); + } await write("procedure", "POST", "api/encounters", { kind: "PROCEDURE", occurredAt: daysAgo(25).toISOString(), diff --git a/tests/integration/openapi-get-contract.test.ts b/tests/integration/openapi-get-contract.test.ts index 47fffdb99..f21ed4cbc 100644 --- a/tests/integration/openapi-get-contract.test.ts +++ b/tests/integration/openapi-get-contract.test.ts @@ -210,6 +210,22 @@ function queriesFor( return [{ nutrient: "vitamin_d" }]; case "/api/day/index": return [{ from: day(14), to: day(0) }]; + case "/api/measurements/provenance": + return [ + { type: "ACTIVITY_STEPS", date: day(2) }, + { type: "WEIGHT", date: day(2) }, + ]; + case "/api/measurements/provenance/compare": + return [ + { type: "ACTIVITY_STEPS", from: day(14), to: day(0) }, + { + type: "ACTIVITY_STEPS", + from: day(14), + to: day(0), + a: "APPLE_HEALTH", + b: "MANUAL", + }, + ]; case "/api/documents/inbound/source": return [{ sourceSystem: "PAPERLESS", sourceId: "4711" }]; case "/api/documents/sources/{system}/search":