From c22c302ebe905f6639f766e0214c7c3657b48abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 15:41:54 +0200 Subject: [PATCH] test(analytics): read the default body where it now lives --- src/app/__tests__/insights-b3-wiring.test.ts | 8 ++++++-- src/app/__tests__/insights-polish.test.ts | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/__tests__/insights-b3-wiring.test.ts b/src/app/__tests__/insights-b3-wiring.test.ts index 08022ab9a..29585d8d2 100644 --- a/src/app/__tests__/insights-b3-wiring.test.ts +++ b/src/app/__tests__/insights-b3-wiring.test.ts @@ -21,7 +21,11 @@ import { join } from "node:path"; const ROOT = join(__dirname, "../../.."); const INSIGHTS_PATH = join(ROOT, "src/app/insights/page-client.tsx"); -const ANALYTICS_ROUTE_PATH = join(ROOT, "src/app/api/analytics/route.ts"); +/** The analytics default body, built outside its route. */ +const ANALYTICS_BODY_PATHS = [ + join(ROOT, "src/lib/analytics/response/default-body.ts"), + join(ROOT, "src/lib/analytics/response/correlations.ts"), +]; const ADVISOR_HOOK_PATH = join( ROOT, "src/components/insights/use-insights-advisor.ts", @@ -84,7 +88,7 @@ describe("v1.4.20 B3 — /api/analytics surfaces correlations", () => { }); it("returns a `correlations` block on the success payload", () => { - const src = load(ANALYTICS_ROUTE_PATH); + const src = ANALYTICS_BODY_PATHS.map(load).join("\n"); expect(src).toMatch(/correlations:\s*correlationsWithPatterns,/); expect(src).toMatch(/computeCorrelationHypotheses/); }); diff --git a/src/app/__tests__/insights-polish.test.ts b/src/app/__tests__/insights-polish.test.ts index 81519269e..59cb8e354 100644 --- a/src/app/__tests__/insights-polish.test.ts +++ b/src/app/__tests__/insights-polish.test.ts @@ -213,8 +213,9 @@ describe("v1.4.22 W5 reconcile (Code-H2) — BD-Zielbereich tile compareDelta us }); it("ships priorMonth + priorYear pcts in the analytics envelope", () => { + // The default body is built outside the route. const ROUTE_SRC = readFileSync( - join(ROOT, "src/app/api/analytics/route.ts"), + join(ROOT, "src/lib/analytics/response/default-body.ts"), "utf8", ); expect(ROUTE_SRC).toContain("bpInTargetPctPriorMonth");