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.
59 lines
2.0 KiB
JavaScript
59 lines
2.0 KiB
JavaScript
'use strict';
|
|
|
|
/** ADR-612 PR-5: the bracket convention card has one runtime source. */
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const { normalizeEol } = require('../msd-core/bin/lib/text-lines.cjs');
|
|
|
|
const {
|
|
phaseIdCard,
|
|
PHASE_ID_CARD,
|
|
PHASE_ID_LEGEND,
|
|
} = require('../msd-core/bin/lib/phase-id-card.cjs');
|
|
|
|
const REFERENCE_PATH = path.join(
|
|
__dirname,
|
|
'..',
|
|
'msd-core',
|
|
'references',
|
|
'phase-id-convention.md',
|
|
);
|
|
|
|
describe('#3638: phase ID convention card single source', () => {
|
|
test('the runtime card labels every identity dimension', () => {
|
|
const rendered = phaseIdCard();
|
|
|
|
assert.match(rendered, /^\[MSD\.02\] 05\.03-01/m);
|
|
assert.match(rendered, /plan\s+01/);
|
|
assert.match(rendered, /subphase\s+03/);
|
|
assert.match(rendered, /phase\s+05/);
|
|
assert.match(rendered, /milestone\s+02/);
|
|
assert.match(rendered, /project\s+MSD/);
|
|
assert.match(PHASE_ID_LEGEND, /no 'Phase' word, no vX\.Y/);
|
|
assert.equal(PHASE_ID_CARD.split('\n').length, 7);
|
|
});
|
|
|
|
test('an optional title composes without mutating the canonical card', () => {
|
|
assert.equal(
|
|
phaseIdCard({ title: 'Bracket convention:' }),
|
|
`Bracket convention:\n\n${PHASE_ID_CARD}\n\n${PHASE_ID_LEGEND}`,
|
|
);
|
|
assert.equal(phaseIdCard(), `${PHASE_ID_CARD}\n\n${PHASE_ID_LEGEND}`);
|
|
});
|
|
|
|
test('the reference card block is generated byte-for-byte from the runtime source', () => {
|
|
const reference = normalizeEol(fs.readFileSync(REFERENCE_PATH, 'utf8'));
|
|
const opener = '<!-- PHASE-ID-CARD:START -->\n```text\n';
|
|
const closer = '\n```\n<!-- PHASE-ID-CARD:END -->';
|
|
const start = reference.indexOf(opener);
|
|
const end = reference.indexOf(closer, start + opener.length);
|
|
|
|
assert.notEqual(start, -1, 'generated card opener must remain present');
|
|
assert.notEqual(end, -1, 'generated card closer must remain present');
|
|
assert.equal(reference.slice(start + opener.length, end), phaseIdCard());
|
|
});
|
|
});
|