From ca9ce962a67576d7a7b227ccffb675a10f29737c Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 17 Sep 2026 14:05:19 +0800 Subject: [PATCH] =?UTF-8?q?test(=E6=8E=92=E7=A8=8B):=20=E8=A6=86=E8=93=8B?= =?UTF-8?q?=E9=87=8D=E8=A4=87=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5 (1M context) --- test/schedule.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/schedule.test.js b/test/schedule.test.js index 6277f01..fbbec8d 100644 --- a/test/schedule.test.js +++ b/test/schedule.test.js @@ -184,3 +184,19 @@ test('這支腳本完全不碰 Gitea:沒有登入資訊也能算', async () => 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, /不只一次/); +});