From 3b7950b290892917fe4c69e418bc873c36ed5ed9 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 17 Sep 2026 13:55:29 +0800 Subject: [PATCH] =?UTF-8?q?test(sdlc-analyze):=20=E9=87=98=E4=BD=8F?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=AE=B5=E7=9A=84=E8=85=B3=E6=9C=AC=E9=A0=86?= =?UTF-8?q?=E5=BA=8F=E8=88=87=E5=B7=B2=E7=9F=A5=E9=99=90=E5=88=B6=E9=82=A3?= =?UTF-8?q?=E4=B8=80=E7=AF=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5 (1M context) --- test/wp-schedule-assets.test.js | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 test/wp-schedule-assets.test.js diff --git a/test/wp-schedule-assets.test.js b/test/wp-schedule-assets.test.js new file mode 100644 index 0000000..607e447 --- /dev/null +++ b/test/wp-schedule-assets.test.js @@ -0,0 +1,68 @@ +/** + * 正本第三段「排上時程與看板」的規則。 + */ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { assertNeutralPrompt, readPrompt } from './helpers/prompt-doc.js'; + +const prompt = readPrompt('sdlc-analyze'); +const phase3 = prompt.slice(prompt.indexOf('## 第三段'), prompt.indexOf('## 架構圖的限制')); + +test('正本仍然平台中立,description 前綴正確', () => { + assertNeutralPrompt(prompt, 'sdlc-analyze'); +}); + +test('第三段指名四支腳本,順序為先算再寫', () => { + const order = ['schedule.js', 'issue-link.js', 'issue-update.js', 'project-add.js']; + const positions = order.map((name) => phase3.indexOf(name)); + assert.equal(positions.every((p) => p >= 0), true, '四支腳本都要被指名'); + assert.deepEqual([...positions].sort((a, b) => a - b), positions, '要先算出截止日才寫得下去'); +}); + +test('計畫檔的格式有可照抄的範例', () => { + assert.match(phase3, /"startDate"/); + assert.match(phase3, /"workPackages"/); + assert.match(phase3, /"depends"/); +}); + +test('交代了拓撲排序保證什麼,以及成環時怎麼辦', () => { + assert.match(phase3, /截止日都不早於它的先決/); + assert.match(phase3, /成環/); + assert.match(phase3, /回頭改拆法/); +}); + +test('說明日期只算日曆日,不替使用者決定跳哪些日子', () => { + assert.match(phase3, /日曆日/); + assert.match(phase3, /不跳週末/); +}); + +test('三支寫入腳本都要求先試跑,並點出它們是冪等的', () => { + assert.match(phase3, /--dry-run/); + assert.match(phase3, /冪等/); +}); + +test('Milestone 與看板都只掛既有的,且交代反查不到時怎麼辦', () => { + assert.match(phase3, /只掛既有的/); + assert.match(phase3, /不建立 Milestone/); + assert.match(phase3, /不建立專案/); + assert.match(phase3, /貼專案網址/); +}); + +test('回報時要指出相依鏈最長路徑', () => { + assert.match(phase3, /相依鏈最長路徑/); +}); + +test('人天估算的 API 限制寫成獨立一節,不是藏在行文裡', () => { + const limit = prompt.slice(prompt.indexOf('## 已知限制'), prompt.indexOf('## 架構圖的限制')); + assert.match(limit, /time_estimate/); + assert.match(limit, /無法由 API 寫入/); + assert.match(limit, /估算人天:/, '要說清楚改寫到哪裡去'); + assert.match(limit, /sdlc-report/, '要說清楚誰會讀這一行'); +}); + +test('邊界把三段各自不做的事分開列', () => { + const boundary = prompt.slice(prompt.indexOf('## 邊界')); + assert.match(boundary, /共識摘要之前不對 Gitea 產生任何寫入/); + assert.match(boundary, /第二段只建立工作包議題/); + assert.match(boundary, /第三段只掛既有的 Milestone 與看板/); +});