Files
msd-core/tests/changeset-render.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

49 lines
1.6 KiB
JavaScript

'use strict';
process.env.MSD_TEST_MODE = '1';
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const path = require('node:path');
const { renderChangelog } = require(path.join(__dirname, '..', 'scripts', 'changeset', 'render.cjs'));
describe('changeset render: pure renderer (#2975)', () => {
test('returns a structured Changelog object with a single Fixed bullet for one fragment', () => {
const fragments = [{ type: 'Fixed', pr: 2975, body: 'fix the thing.' }];
const result = renderChangelog({
fragments,
version: '1.42.0',
date: '2026-05-01',
priorChangelog: null,
});
assert.deepEqual(result.releaseHeader, { version: '1.42.0', date: '2026-05-01' });
assert.equal(result.sections.length, 1);
assert.deepEqual(result.sections[0], {
type: 'Fixed',
bullets: [{ pr: 2975, body: 'fix the thing.' }],
});
});
test('groups multiple fragments by type with deterministic section order (Keep a Changelog convention)', () => {
const fragments = [
{ type: 'Fixed', pr: 1, body: 'fix A' },
{ type: 'Added', pr: 2, body: 'add B' },
{ type: 'Fixed', pr: 3, body: 'fix C' },
{ type: 'Changed', pr: 4, body: 'change D' },
];
const result = renderChangelog({ fragments, version: '1.0.0', date: '2026-01-01' });
assert.deepEqual(
result.sections.map((s) => s.type),
['Added', 'Changed', 'Fixed'],
);
const fixed = result.sections.find((s) => s.type === 'Fixed');
assert.deepEqual(
fixed.bullets.map((b) => b.pr),
[1, 3],
'bullets within a section preserve fragment order',
);
});
});