Files
houseplan-card/test/space-card-audit-lows.test.mjs
T
Codex 2e32cbcb38 fix: small honesty batch from the beta.4 audit (#376)
(а) title: null gets the same compact frame as title: '' — YAML 'title:'
with no value parses as null, the owner's decision makes them synonyms.
(б) the guides state that room labels are inert in the Background editor.
(г) furniture strokes skip the flat-camera compensation in the labs iso
projection, tracking ordinary decor there.
(д) TESTING.md notes the light_pools opt-in for static room cards.
(е) the space-card dispose gate mirrors the strict === true render gate.

User-Visible: yes
Issue: #376
2026-08-29 21:54:29 +03:00

26 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const card = readFileSync(new URL('../src/space-card.ts', import.meta.url), 'utf8');
// #376(а): YAML `title:` with no value parses as null. The owner decided null
// and '' mean the same thing — no header AND the compact frame. The behaviour
// is proven end-to-end by demo/smoke_space_card.mjs (nullTitleFrame); this
// contract keeps the condition from silently narrowing back to '' only.
test('#376(а) the compact frame accepts both the empty string and null title', () => {
assert.match(card,
/compactTopFrame: this\._config\.title === '' \|\| this\._config\.title === null,/);
});
// #376(е): the render gate is strict `=== true`; the dispose gate must be its
// exact mirror, so a truthy-but-not-true value (light_pools: 1) neither draws
// pools nor keeps a glow runtime and a blend probe alive.
test('#376(е) light_pools gates are symmetric: anything but true disposes', () => {
assert.match(card, /lightPools: this\._config\.light_pools === true,/);
assert.match(card,
/if \(this\._config\.light_pools !== true\) \{\s*\n\s*disposeGlowRuntime\(/);
assert.ok(!/if \(!this\._config\.light_pools\) \{\s*\n\s*disposeGlowRuntime\(/.test(card),
'the old truthy dispose gate must not return');
});