mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Add Scrum to board copy choices and reuse transfer remapping for planning records, metadata and snapshots. Collect copied list and swimlane IDs, omit deselected Scrum data and label reduced snapshots in reports and exports. Thanks to xet7 !
21 lines
1.4 KiB
JavaScript
21 lines
1.4 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const { test } = require('node:test');
|
|
test('board duplication choices default to all and preserve parent-child consistency', async () => {
|
|
const { allBoardCopyOptions, normalizeBoardCopyOptions, toggleBoardCopyOption } = await import('../models/lib/boardCopyOptions.js');
|
|
assert.ok(Object.values(normalizeBoardCopyOptions()).every(Boolean));
|
|
const none = allBoardCopyOptions(false);
|
|
assert.ok(Object.values(normalizeBoardCopyOptions(none)).every(v => !v));
|
|
const comments = toggleBoardCopyOption(none, 'comments');
|
|
assert.deepEqual(Object.keys(comments).filter(k => comments[k]), ['swimlanes', 'lists', 'cards', 'comments']);
|
|
assert.deepEqual(toggleBoardCopyOption(comments, 'swimlanes'), none);
|
|
const noCards = toggleBoardCopyOption(allBoardCopyOptions(), 'cards');
|
|
for (const key of ['cards', 'checklists', 'comments', 'attachments']) assert.equal(noCards[key], false);
|
|
assert.equal(noCards.lists, true);
|
|
assert.equal(noCards.rules, true);
|
|
const scrum = toggleBoardCopyOption(none, 'scrum');
|
|
assert.equal(scrum.customFields, true);
|
|
assert.equal(toggleBoardCopyOption(scrum, 'customFields').scrum, false);
|
|
for (const input of [null, [], true, { cards: 'false' }, { unexpected: true }, JSON.parse('{"__proto__":true}')]) assert.throws(() => normalizeBoardCopyOptions(input));
|
|
assert.throws(() => toggleBoardCopyOption(none, 'constructor'));
|
|
});
|