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.
57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
/**
|
|
* Regression test for #2116 — commands/msd/surface.md had unresolvable bare
|
|
* `require('msd-core/...')` specifiers and a wrong-package reinstall hint
|
|
* (`npm i -g msd-core` instead of `@golem15/msd-core`).
|
|
*
|
|
* This test asserts the doc uses resolvable paths (derived from runtimeConfigDir)
|
|
* and the correct scoped package name in the reinstall hint.
|
|
*/
|
|
'use strict';
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const SURFACE_MD = path.join(__dirname, '..', 'commands', 'msd', 'surface.md');
|
|
|
|
describe('#2116 regression: surface.md resolvable require + correct package', () => {
|
|
const content = fs.readFileSync(SURFACE_MD, 'utf-8');
|
|
|
|
test('no bare require("msd-core/...") specifiers', () => {
|
|
assert.ok(
|
|
!content.match(/require\s*\(\s*['"]msd-core\//),
|
|
'surface.md should not use bare require(\'msd-core/...\') — use runtimeConfigDir-derived path (#2116)'
|
|
);
|
|
});
|
|
|
|
test('reinstall hint uses scoped package name', () => {
|
|
assert.ok(
|
|
content.includes('@golem15/msd-core'),
|
|
'surface.md reinstall hint should reference @golem15/msd-core, not bare msd-core (#2116)'
|
|
);
|
|
});
|
|
|
|
test('require examples use runtimeConfigDir-derived paths', () => {
|
|
assert.ok(
|
|
content.includes("require(runtimeConfigDir + '/msd-core/bin/lib/capability-registry.cjs')"),
|
|
'surface.md require examples should derive the path from runtimeConfigDir (#2116)'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('#4132 regression: surface.md uses the state-last public contract', () => {
|
|
// allow-test-rule: source-text-is-the-product (#4132)
|
|
const content = fs.readFileSync(SURFACE_MD, 'utf-8');
|
|
|
|
test('mutations pass an in-memory candidate without an eager state write', () => {
|
|
assert.match(content, /surfaceState/);
|
|
assert.match(content, /publishes the candidate state only after/);
|
|
assert.doesNotMatch(content, /writeSurface\(runtimeConfigDir, surfaceState\)/);
|
|
});
|
|
|
|
test('reset is represented as an absent-state candidate, not an eager delete', () => {
|
|
assert.match(content, /surfaceState: null/);
|
|
});
|
|
});
|