test(series): follow the hour bucket into the route mock and the dated-fixture guard

The route test recognised the bucket statement by its old GROUP BY
column, and the new fall-back-night test reads from a fixed date, which
the dated-fixture guard now allowlists with its reason.
This commit is contained in:
Marc-André Bombeck committed 2026-11-02 20:14:18 +01:00
1 parent e7c625cab7
commit 7dfc2cbbea
2 files changed
+8 -3

No files matched your search

@@ -83,6 +83,11 @@ const ALLOWLIST: Record<string, { max: number; reason: string }> = {
reason:
"the discovery matrix reads from a fixed since forward; the fixture days stay inside it as now moves on",
},
"tests/integration/dense-series-dst-hour.test.ts": {
max: 1,
reason:
"the read starts at a fixed fall-back night and runs forward to now; the readings are pinned to that night, so the case cannot age",
},
};
export interface AgingFinding {
@@ -131,7 +131,7 @@ function req(query: string): NextRequest {
* `tests/integration/series-source-ladder.test.ts`.
*/
function adaptSeriesSql(sql: string): Promise<unknown> {
if (/GROUP BY local_day|STDDEV_POP/.test(sql)) {
if (/GROUP BY (?:local_day|bucket_start)|STDDEV_POP/.test(sql)) {
return (prisma.$queryRaw as unknown as () => Promise<unknown>)();
}
const type = /'([A-Z0-9_]+)'::"measurement_type"/.exec(sql)?.[1];
@@ -914,7 +914,7 @@ describe("GET /api/measurements/series — dense-kind day-bucketing (v1.28.25)",
const bucketCall = vi
.mocked(prisma.$queryRawUnsafe)
.mock.calls.find(([sql]) =>
/GROUP BY local_day/.test(sql as string),
/GROUP BY (?:local_day|bucket_start)/.test(sql as string),
) as unknown[];
expect(bucketCall.slice(1)).toContain("hour");
});
@@ -981,7 +981,7 @@ describe("GET /api/measurements/series — dense-kind day-bucketing (v1.28.25)",
const bucketCall = vi
.mocked(prisma.$queryRawUnsafe)
.mock.calls.find(([sql]) =>
/GROUP BY local_day/.test(sql as string),
/GROUP BY (?:local_day|bucket_start)/.test(sql as string),
) as unknown[];
expect(bucketCall.slice(1)).toContain("hour");
});