refactor(api): extract computation graph project snapshot

This commit is contained in:
2026-03-31 10:12:05 +02:00
parent f24d8deacf
commit 45c90438ba
4 changed files with 470 additions and 449 deletions
@@ -315,4 +315,24 @@ describe("computation graph router", () => {
expect(result.nodes.every((node) => node.domain === "BUDGET")).toBe(true);
expect(result.links?.length).toBe(result.selectedLinkCount);
});
it("returns the project snapshot graph through the base router contract", async () => {
const db = createProjectDb(vi.fn().mockResolvedValue(buildProject()));
const caller = createControllerCaller(db);
const result = await caller.getProjectData({
projectId: "project_1",
});
expect(result.meta).toEqual({
projectName: "Gelddruckmaschine",
projectCode: "GDM",
});
expect(result.nodes.map((node) => node.id)).toEqual(expect.arrayContaining([
"input.budgetCents",
"input.winProbability",
"budget.allocatedCents",
]));
expect(result.links.length).toBeGreaterThan(0);
});
});