Files
fusion/scripts/__tests__/changelog-archive.test.mjs
gsxdsm f7d29dd1da chore: archive pre-0.60 changelog notes and distill corrupted 0.47–0.59 entries
Raise the durable archive cutoff to 0.60.0, keep only the current release in CHANGELOG.md, and rewrite labeled summary/category/dev package aggregates for 0.47–0.59 into operator-facing Highlights/New/Fixed notes.
2026-07-13 23:00:25 -07:00

60 lines
1.7 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import {
archivePointerLine,
CHANGELOG_ARCHIVE_CUTOFF,
CHANGELOG_ARCHIVE_FILE,
partitionVersionsByCutoff,
} from "../lib/changelog-archive.mjs";
test("partitions versions at the pre-0.60 archive cutoff", () => {
assert.deepEqual(
partitionVersionsByCutoff(["0.60.0", "0.59.0", "0.50.0", "0.11.1"]),
{
current: ["0.60.0"],
archived: ["0.59.0", "0.50.0", "0.11.1"],
},
);
});
test("keeps the 0.60.0 boundary and newer patch versions current", () => {
const partitioned = partitionVersionsByCutoff(["0.61.0", "0.60.0", "0.59.0"]);
assert.deepEqual(partitioned.current, ["0.61.0", "0.60.0"]);
assert.deepEqual(partitioned.archived, ["0.59.0"]);
});
test("preserves input order and archives non-parseable version keys", () => {
const partitioned = partitionVersionsByCutoff([
"0.61.0",
"legacy notes",
"0.60.0 (pre-release, unpublished)",
"0.59.9",
"0.62.0",
]);
assert.deepEqual(partitioned.current, [
"0.61.0",
"0.60.0 (pre-release, unpublished)",
"0.62.0",
]);
assert.deepEqual(partitioned.archived, ["legacy notes", "0.59.9"]);
});
test("supports a custom cutoff with release.mjs semver-ish parsing", () => {
assert.deepEqual(partitionVersionsByCutoff(["1.2.0", "1.1.9", "not semver"], "1.2.0"), {
current: ["1.2.0"],
archived: ["1.1.9", "not semver"],
});
});
test("archive pointer references the archive file and cutoff", () => {
const pointer = archivePointerLine();
assert.ok(pointer.includes(CHANGELOG_ARCHIVE_FILE));
assert.ok(pointer.includes(CHANGELOG_ARCHIVE_CUTOFF));
assert.equal(CHANGELOG_ARCHIVE_CUTOFF, "0.60.0");
assert.match(pointer, /\.\/CHANGELOG-archive\.md/);
});