Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scripts/build-milestones.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,20 @@ milestones.forEach((m, i) => {
console.error(`ERROR: milestone[${i}] (id="${m.id}") reference must be a string URL.`);
process.exit(1);
}

if (m.extinctionMarker !== undefined && m.extinctionMarker !== true) {
console.error(`ERROR: milestone[${i}] (id="${m.id}") extinctionMarker must be true if set.`);
process.exit(1);
}
});

const extinctionMarkers = milestones.filter((m) => m.extinctionMarker === true);
if (extinctionMarkers.length > 1) {
const ids = extinctionMarkers.map((m) => `"${m.id}"`).join(', ');
console.error(`ERROR: exactly one milestone may have extinctionMarker: true, but found ${extinctionMarkers.length}: ${ids}`);
process.exit(1);
}

// ── Generate JS ───────────────────────────────────────────────────────────────
function jsString(s) {
// Emit as a template-literal-safe single-quoted JS string.
Expand Down
5 changes: 5 additions & 0 deletions tests/death-clock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ describe('Constants', () => {
}
});

test('at most one milestone has extinctionMarker: true', () => {
const marked = MILESTONES.filter((m) => m.extinctionMarker === true);
expect(marked.length).toBeLessThanOrEqual(1);
});

test('HISTORICAL_DATA is a non-empty array', () => {
expect(Array.isArray(HISTORICAL_DATA)).toBe(true);
expect(HISTORICAL_DATA.length).toBeGreaterThan(0);
Expand Down
Loading