fix(sync): normalize section separators in regenerate()
A previous run could merge the '---' separator with the next section
header (---## ✅ Befejezett), breaking section detection. Prefix/suffix
are now trimmed and rejoined with fixed separators. Regression test
added; also create Plane issues for local-only completed work
(MITHOME-28 Custom CMS, MITHOME-29 Webmail) to avoid ID collisions.
This commit is contained in:
@@ -162,3 +162,25 @@ test('buildTable sorts rows by sequence number', () => {
|
||||
assert.equal(lines[2], '| MITHOME-1 | A | ✅ |');
|
||||
assert.equal(lines[3], '| MITHOME-15 | B | ✅ |');
|
||||
});
|
||||
|
||||
// Regression: a previous run dropping the blank line after `---` must not merge
|
||||
// the separator with the section header (`---## ✅ Befejezett`).
|
||||
test('regenerate always separates `---` from section headers', () => {
|
||||
const planeIssues = [
|
||||
{ sequence_id: 1, name: 'Kezdőlap', state: { group: 'completed' } },
|
||||
{ sequence_id: 13, name: 'CI pipeline', state: { group: 'unstarted' } },
|
||||
{ sequence_id: 17, name: 'Winston logger + Loki integráció', state: { group: 'started' } },
|
||||
{ sequence_id: 19, name: 'Accessibility', state: { group: 'backlog' } }
|
||||
];
|
||||
const { rows } = parseTodoFile(SAMPLE_TODO);
|
||||
const buildData = buildDiscrepancies(planeIssues, rows, 'MITHOME');
|
||||
const decisions = { moveToPlane: new Set(), keepOrphan: new Set(), addNew: new Set() };
|
||||
const final = buildFinalSections(buildData, decisions);
|
||||
|
||||
const corrupted = SAMPLE_TODO.replace('---\n\n## ✅ Befejezett', '---## ✅ Befejezett');
|
||||
const output = regenerate(corrupted, final);
|
||||
|
||||
assert.ok(output.includes('---\n\n## ✅ Befejezett'), 'header must be separated from ---');
|
||||
assert.ok(!output.includes('---##'), 'no merged separator+header');
|
||||
assert.ok(output.includes('## ✅ Befejezett'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user