test(排程): 覆蓋重複 index

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 14:05:19 +08:00
co-authored by Claude Opus 5
parent e23dc57d34
commit ca9ce962a6
+16
View File
@@ -184,3 +184,19 @@ test('這支腳本完全不碰 Gitea:沒有登入資訊也能算', async () =>
assert.equal(code, 0); assert.equal(code, 0);
}); });
test('同一個 index 出現兩次時中止,不把兩份定義混在一起算', async () => {
// 混出來的結果會是:相依看後者、標題與人天取前者,而且完全不報錯
const { code, json } = await run({
startDate: '2026-09-21',
workPackages: [
{ index: 1, title: '第一份定義', days: 1 },
{ index: 1, title: '第二份定義', days: 100 },
{ index: 2, title: '乙', days: 1, depends: [1] },
],
});
assert.equal(code, 1);
assert.equal(json.error.code, 'BAD_PLAN');
assert.match(json.error.message, /不只一次/);
});