Files
msd-core/tests/broken-windows-description.test.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

44 lines
1.9 KiB
JavaScript

const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
test('broken-windows capability description specifies enforcement is opt-in', () => {
const capabilityPath = path.join(__dirname, '..', 'capabilities', 'broken-windows', 'capability.json');
const capabilityJson = JSON.parse(fs.readFileSync(capabilityPath, 'utf8'));
assert.ok(
capabilityJson.description.includes('When enforcement is enabled') || capabilityJson.description.includes('workflow.windows_enforce'),
`capability.json description should state enforcement is opt-in, got: ${capabilityJson.description}`
);
// Re-anchored: the unqualified sentence on next ("Blocks /msd-ship while any window is open") must not be present
assert.strictEqual(
capabilityJson.description.includes('Blocks /msd-ship while any window is open'),
false,
'description must not contain unqualified unconditional ship blocking sentence'
);
// Behavioral gate contract test: verify the ship:pre gate is gated on workflow.windows_enforce
const shipGate = capabilityJson.gates.find(g => g.point === 'ship:pre');
assert.ok(shipGate, 'broken-windows capability must declare ship:pre gate');
assert.strictEqual(
shipGate.when,
'workflow.windows_enforce',
'ship:pre gate must be gated on workflow.windows_enforce config key'
);
// Behavioral test for renderLedger
const bw = require('../msd-core/bin/lib/broken-windows.cjs');
const rendered = bw.renderLedger(bw.emptyLedger());
assert.strictEqual(
rendered.includes('> Cross-phase defect register. `/msd-ship` blocks while `open_count > 0`.'),
false,
'renderLedger must not contain unqualified blocking sentence'
);
assert.ok(
rendered.includes('With `workflow.windows_enforce` enabled, `/msd-ship` blocks'),
'renderLedger must document opt-in enforcement'
);
});