test(sdlc-analyze): 釘住第三段的腳本順序與已知限制那一節
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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 與看板/);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user