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");