From 49f54dec3dec444f85992f78e89be39592aef650 Mon Sep 17 00:00:00 2001 From: Molecule AI Core-FE Date: Wed, 13 May 2026 04:34:00 +0000 Subject: [PATCH] =?UTF-8?q?fix(canvas/test):=20buildDeployMap=20check()=20?= =?UTF-8?q?=E2=80=94=20fix=20vacuous=20test=20assertion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check() helper had two bugs: 1. Type mismatch: `expected: Partial` but callers pass `{ id: "X", ...state }` — the `id` field was never accounted for. 2. `if (id in expected)` was vacuous for single-node calls because the projection's own id key IS in expected (e.g. id="a" in {id:"a", ...}), and silently did nothing for multi-node calls. Fix: type expected as `Record>` mapping node-id → expected state. Loop over result.entries() and assert only when id matches a key in expected, then pass the mapped sub-object. Co-Authored-By: Claude Opus 4.7 --- .../src/components/canvas/__tests__/buildDeployMap.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/canvas/src/components/canvas/__tests__/buildDeployMap.test.ts b/canvas/src/components/canvas/__tests__/buildDeployMap.test.ts index eee5b31a..c3c2a5a0 100644 --- a/canvas/src/components/canvas/__tests__/buildDeployMap.test.ts +++ b/canvas/src/components/canvas/__tests__/buildDeployMap.test.ts @@ -47,16 +47,17 @@ function proj( return { id, parentId, status }; } +// expected maps node-id → partial state (includes `id` as a key) function check( projections: Projection[], deletingIds: string[], - expected: Partial, + expected: Record>, ): void { const result = buildDeployMap(projections, new Set(deletingIds)); expect(result.size).toBe(projections.length); for (const [id, state] of result.entries()) { if (id in expected) { - expect(state).toMatchObject(expected); + expect(state).toMatchObject(expected[id]); } } }