Tighten rejection tests to their expected errors

Every assert.throws now names the error it expects, so a broken fixture
or an unrelated failure can no longer satisfy a rejection test. Zod
rejections are matched by issue path and code via tests/support/zod-assertions.ts.

Restore snapshot coverage lost with the release baseline: invalid board
floor, room floor and circuit section references and a reserve state
that contradicts the device rows are rejected again under test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian Appel 2026-10-29 12:27:46 +01:00
parent cc4eefcb86
commit a8cc7eca5e
8 changed files with 269 additions and 122 deletions

View file

@ -253,19 +253,23 @@ describe("project building structure", () => {
assert.equal(getFloor(context, legacyFloor.id)?.name, "EG");
// A version 1 snapshot must not carry buildingId, a version 2 one must.
assert.throws(() =>
assertProjectFloorInsertProjectCommand({
schemaVersion: 1,
type: "project-floor.insert",
payload: { floor: { ...legacyFloor, buildingId: null } },
})
assert.throws(
() =>
assertProjectFloorInsertProjectCommand({
schemaVersion: 1,
type: "project-floor.insert",
payload: { floor: { ...legacyFloor, buildingId: null } },
}),
/Project-floor snapshot is invalid/
);
assert.throws(() =>
assertProjectFloorInsertProjectCommand({
schemaVersion: 2,
type: "project-floor.insert",
payload: { floor: legacyFloor },
})
assert.throws(
() =>
assertProjectFloorInsertProjectCommand({
schemaVersion: 2,
type: "project-floor.insert",
payload: { floor: legacyFloor },
}),
/Project-floor snapshot is invalid/
);
} finally {
context.close();