Files
msd-core/tests/methodology-artifact.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

138 lines
5.6 KiB
JavaScript

'use strict';
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const ROOT = path.join(__dirname, '..');
const REFERENCES_DIR = path.join(ROOT, 'msd-core', 'references');
const WORKFLOWS_DIR = path.join(ROOT, 'msd-core', 'workflows');
describe('methodology artifact type (#1488)', () => {
// -------------------------------------------------------------------------
// artifact-types.md existence and structure
// -------------------------------------------------------------------------
let artifactTypesContent;
test('artifact-types.md exists in msd-core/references/', () => {
const p = path.join(REFERENCES_DIR, 'artifact-types.md');
assert.ok(fs.existsSync(p), 'msd-core/references/artifact-types.md must exist');
artifactTypesContent = fs.readFileSync(p, 'utf-8');
});
test('artifact-types.md documents the methodology artifact type', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('methodology') || artifactTypesContent.includes('Methodology'),
'artifact-types.md must document the methodology artifact type'
);
});
test('methodology artifact has shape documented (standing reference)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('Standing reference') ||
artifactTypesContent.includes('standing reference') ||
artifactTypesContent.includes('reusable interpretive') ||
artifactTypesContent.includes('interpretive framework'),
'methodology artifact must have shape documented as standing reference / interpretive framework'
);
});
test('methodology artifact has lifecycle documented (Created → Active → Superseded)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('Superseded') || artifactTypesContent.includes('superseded'),
'methodology artifact lifecycle must include Superseded state'
);
assert.ok(
artifactTypesContent.includes('Active') || artifactTypesContent.includes('active'),
'methodology artifact lifecycle must include Active state'
);
});
test('methodology artifact has location documented (.planning/METHODOLOGY.md)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('METHODOLOGY.md'),
'artifact-types.md must document .planning/METHODOLOGY.md as the location'
);
});
test('methodology artifact documents what it is consumed by', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.toLowerCase().includes('consumed by') ||
artifactTypesContent.toLowerCase().includes('consumption'),
'methodology artifact must document its consumption mechanism'
);
});
// -------------------------------------------------------------------------
// Consumption in discuss-phase-assumptions.md
// -------------------------------------------------------------------------
let discussContent;
test('discuss-phase-assumptions.md exists', () => {
const p = path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md');
assert.ok(fs.existsSync(p), 'discuss-phase-assumptions.md must exist');
discussContent = fs.readFileSync(p, 'utf-8');
});
test('discuss-phase-assumptions.md references METHODOLOGY.md as consumable artifact', () => {
discussContent = discussContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md'), 'utf-8'
);
assert.ok(
discussContent.includes('METHODOLOGY.md'),
'discuss-phase-assumptions.md must reference METHODOLOGY.md as a consumable artifact'
);
});
test('discuss-phase-assumptions.md reads METHODOLOGY.md when it exists', () => {
discussContent = discussContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md'), 'utf-8'
);
assert.ok(
discussContent.includes('METHODOLOGY.md') &&
(discussContent.includes('if it exists') ||
discussContent.includes('2>/dev/null') ||
discussContent.includes('cat .planning/METHODOLOGY') ||
discussContent.includes('exists') ||
discussContent.includes('lenses')),
'discuss-phase-assumptions.md must conditionally read METHODOLOGY.md and apply lenses'
);
});
// -------------------------------------------------------------------------
// Consumption in pause-work.md Required Reading section
// -------------------------------------------------------------------------
let pauseContent;
test('pause-work.md exists', () => {
const p = path.join(WORKFLOWS_DIR, 'pause-work.md');
assert.ok(fs.existsSync(p), 'pause-work.md must exist');
pauseContent = fs.readFileSync(p, 'utf-8');
});
test('pause-work.md Required Reading template includes METHODOLOGY.md', () => {
pauseContent = pauseContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'pause-work.md'), 'utf-8'
);
assert.ok(
pauseContent.includes('METHODOLOGY.md'),
'pause-work.md Required Reading template must include METHODOLOGY.md so new sessions inherit the methodology'
);
});
});