Files
houseplan-card/test/furniture-assets.test.mjs
T
Codex 8ee1c91fff fix: seven small honesty fixes from the 29.08 audit (#369)
(a) documented: deleting a vacuum marker erases its server trail at once
and a re-added marker starts from scratch (VACUUM.md + both USER-GUIDEs).
(b) smoothVacPath reports dropped non-finite segments — one console warn
per call with the count — instead of hiding the whole trail silently on a
broken calibration matrix. (c) room climate (#317) now reaches legacy
markers whose exported config carries an ABSENT area key rather than an
explicit null: `== null` where the placement is decided. (d) the armed
furniture preview follows Shift without mouse movement — window
keydown/keyup listeners live exactly as long as the palette is armed,
detached at every palette teardown. (e) only the primary mouse button
places decor/furniture: a right or middle click with an armed tool is a
no-op, touch/pen untouched. (f) a device whose registry entities were ALL
deliberately disabled by the user no longer glows as an alive controller —
the #318 entityless-active rule now requires a genuinely empty roster.
(g) furniture-pack author corrected to Sergey Matyunin (Сергей Матюнин)
per the owner's decision — LICENSE.md, README.md, pack.json,
docs/FURNITURE.md, the provenance check in generate-furniture-assets and
its unit; the source archive bytes are unchanged and the README notes the
romanisation fix.

Proofs: units for (b)/(c)/(f) including the #318 regression pair; new
smoke_furniture_polish for (d)/(e) with listener add/remove counters and
both mouse buttons; five registry mutants, one per code change.

Issue: #369
User-Visible: yes
2026-08-29 11:29:42 +03:00

55 lines
2.7 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { GENERATED_FURNITURE_PLAN } from '../test-build/furniture-plan-art.generated.js';
import { FURNITURE } from '../test-build/furniture.js';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const MANIFEST = JSON.parse(fs.readFileSync(
path.join(ROOT, 'assets', 'furniture', 'houseplan-0.3.0', 'pack.json'), 'utf8'));
test('the vendored designer pack and generated modules stay in sync', () => {
const result = spawnSync(process.execPath, ['scripts/generate-furniture-assets.mjs', '--check'], {
cwd: ROOT,
encoding: 'utf8',
});
assert.equal(result.status, 0, result.stderr || result.stdout);
assert.match(result.stdout, /44 plan symbols, 33 menu icons/);
});
test('the designer pack has the reviewed cardinality and operations', () => {
assert.equal(GENERATED_FURNITURE_PLAN.length, 44);
assert.equal(MANIFEST.menu_icons.length, 33);
assert.equal(MANIFEST.symbols.filter((s) => s.operation === 'replace').length, 18);
assert.equal(MANIFEST.symbols.filter((s) => s.operation === 'add').length, 26);
assert.equal(FURNITURE.length, 56);
});
test('menu-only artwork never becomes an empty user-facing category', () => {
const categories = new Set(FURNITURE.map((symbol) => symbol.category));
for (const id of ['computer', 'oven', 'hood', 'exercise']) assert.equal(categories.has(id), false);
for (const id of ['coffee_table', 'bed', 'kitchen_cabinet', 'toilet']) assert.equal(categories.has(id), true);
});
test('front-view menu artwork is reachable only through the lazy editor graph', () => {
const card = fs.readFileSync(path.join(ROOT, 'src', 'houseplan-card.ts'), 'utf8');
const furniture = fs.readFileSync(path.join(ROOT, 'src', 'furniture.ts'), 'utf8');
const runtime = fs.readFileSync(path.join(ROOT, 'src', 'houseplan-editor-runtime.ts'), 'utf8');
assert.doesNotMatch(card, /furniture-menu-art\.generated/);
assert.doesNotMatch(furniture, /furniture-menu-art\.generated/);
assert.match(runtime, /from '\.\/furniture-menu-art\.generated'/);
});
test('release provenance is normalized to the repository MIT grant', () => {
assert.equal(MANIFEST.author, 'Sergey Matyunin (Matysh)');
assert.equal(MANIFEST.license, 'MIT');
const readme = fs.readFileSync(
path.join(ROOT, 'assets', 'furniture', 'houseplan-0.3.0', 'README.md'), 'utf8');
assert.match(readme, /issuecomment-5454085168/);
assert.match(readme, /issuecomment-5449707137/);
assert.match(readme, /9E969016EE3B4B4E3DB776FEC53C8B387B91368B118EB5E39911483DEF1B0953/);
});