Files
wekan/tests/todoFile.test.cjs
T
Lauri Ojansivu 879627c641 Move TODO Later from the changelog to TODO.md.
The changelog now says only what changed. What is not done yet, with
why, is in TODO.md at the repository root; Status links it. When an
item is done it is removed from TODO.md and its entry goes into the
Upcoming section of CHANGELOG-big.md. CLAUDE.md and AGENTS.md say so,
tests/changelogFormat.test.cjs checks the changelog no longer carries
TODO Later, and tests/todoFile.test.cjs checks TODO.md's shape.

TODO.md also records three maintainer decisions left open by
ListLockBulkBleed: whether per-list role exceptions should apply to
dependency lines, to the rules engine's own actions, and to deleting,
archiving or moving whole lists and swimlanes.

Thanks to xet7 !
2026-11-18 22:32:52 +02:00

54 lines
2.6 KiB
JavaScript

'use strict';
// TODO.md holds what is not done yet, with why. It was the TODO Later block in
// `# Status` of CHANGELOG-big.md until 2026-11-18. When an item is done it is
// removed here and its entry goes into the changelog's Upcoming section.
// Run: node --test tests/todoFile.test.cjs
const test = require('node:test');
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const read = rel => fs.readFileSync(path.join(__dirname, '..', rel), 'utf8');
const todo = read('TODO.md');
const items = todo.split('\n').filter(line => line.startsWith('- '));
const categories = todo.split(/^## /m).slice(1);
test('TODO.md says what it is, and every category holds an item', () => {
assert.match(todo, /^# TODO\n/);
assert.match(todo, /REMOVE it from this file and write its entry/);
assert.ok(categories.length > 0, 'at least one category');
for (const category of categories) {
assert.ok(/^- /m.test(category), `an emptied category is removed: ${category.split('\n')[0]}`);
}
});
test('negative: nothing in TODO.md is done - no thanks, no commit links, no bare issue numbers', () => {
assert.doesNotMatch(todo, /Thanks to /);
assert.doesNotMatch(todo, /wekan\/commit\//);
assert.doesNotMatch(todo, /<details>|<summary>/, 'plain Markdown');
const body = todo.replace(/\[#\d+\]\(https:\/\/github\.com\/wekan\/wekan\/issues\/\d+\)/g, '')
// GHSA ids and the per-list issue number (#4527) named as context are text.
.replace(/#4527\b/g, '');
const bare = /(^|[^\[\/\w])#\d{3,5}\b/.exec(body);
assert.ok(!bare, `an issue named without its link: ${bare && bare[0]}`);
});
test('the changelog keeps no TODO Later of its own and points to TODO.md', () => {
const changelog = read('CHANGELOG-big.md');
const status = changelog.slice(0, changelog.search(/^# (?:v\d|Upcoming WeKan)/m));
assert.doesNotMatch(status, /<summary>TODO Later<\/summary>/);
assert.match(status, /\[TODO\.md\]\(TODO\.md\)/);
});
test('an issue fixed in the Upcoming release is no longer in TODO.md', () => {
const changelog = read('CHANGELOG-big.md');
const start = changelog.indexOf('# Upcoming WeKan ® release');
if (start < 0) return;
const end = changelog.indexOf('\n# v', start);
const upcoming = changelog.slice(start, end < 0 ? undefined : end);
const listed = new Set([...todo.matchAll(/issues\/(\d+)\)/g)].map(m => m[1]));
const fixed = [...upcoming.matchAll(/Fixes #(\d+)|issues\/(\d+)\)\s*\(fixed/g)].map(m => m[1] || m[2]);
assert.deepStrictEqual(fixed.filter(n => listed.has(n)), []);
assert.ok(items.length > 0);
});