71 lines
3.5 KiB
JavaScript
71 lines
3.5 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { assertNeutralPrompt, readPrompt } from './helpers/prompt-doc.js';
|
|
|
|
const prompt = readPrompt('sdlc-feat');
|
|
const 分流 = prompt.slice(prompt.indexOf('## 交付文件待辦分流'), prompt.indexOf('## 實作與交付'));
|
|
|
|
// ── 正本基本契約 ───────────────────────────────────────────────────
|
|
|
|
test('正本平台中立,description 前綴正確', () => {
|
|
assertNeutralPrompt(prompt, 'sdlc-feat');
|
|
});
|
|
|
|
test('輸入先抽取工作包並保留留言接回流程', () => {
|
|
assert.match(prompt, /scripts\/wp-extract\.js/);
|
|
assert.match(prompt, /未處理留言數/);
|
|
assert.match(prompt, /重新抽取一次/);
|
|
});
|
|
|
|
test('保留 worktree、依賴、驗收與 PR 的既有交付流程', () => {
|
|
assert.match(prompt, /依工作包 `repos` 逐一準備 worktree/);
|
|
assert.match(prompt, /立即勾選對應驗收/);
|
|
assert.match(prompt, /scripts\/pr-create\.js --dry-run/);
|
|
});
|
|
|
|
// ── 交付文件分流 ───────────────────────────────────────────────────
|
|
|
|
test('交付文件待辦與程式碼待辦走不同流程', () => {
|
|
assert.match(分流, /判定為程式碼待辦或交付文件待辦/);
|
|
assert.match(分流, /不可共用無差別的實作流程/);
|
|
assert.match(分流, /references\/delivery-types\.md/);
|
|
});
|
|
|
|
test('每份文件產出前逐一列骨架並一次確認一題', () => {
|
|
assert.match(分流, /每一份交付文件都要分開處理/);
|
|
assert.match(分流, /必要內容骨架、已知來源、未決事項、建議與理由/);
|
|
assert.match(分流, /一次只問一題確認內容是否齊全/);
|
|
assert.match(分流, /未確認的文件不可標成已交付/);
|
|
});
|
|
|
|
test('預覽能力以可開啟可分享能力判斷,具備時直接產出', () => {
|
|
assert.match(分流, /即時發佈成可開啟、可分享的預覽頁/);
|
|
assert.match(分流, /具備能力後直接產出預覽/);
|
|
assert.match(分流, /回報實際位置與內容摘要/);
|
|
});
|
|
|
|
test('預覽能力不足時一次一題詢問,建議由情境推導', () => {
|
|
assert.match(分流, /無法證明具備能力、預覽不可開啟或不可分享/);
|
|
assert.match(分流, /一次只問一題/);
|
|
assert.match(分流, /依文件、來源與限制提出建議及理由/);
|
|
assert.match(分流, /保留手動輸入/);
|
|
assert.match(分流, /不替使用者決定交付方式/);
|
|
assert.match(分流, /不要靠固定清單或猜測環境/);
|
|
assert.match(prompt, /不產生固定選項清單/);
|
|
});
|
|
|
|
// ── ELI5 與契約邊界 ─────────────────────────────────────────────────
|
|
|
|
test('ELI5 保留技術意義並把圖表改成圖片式視覺', () => {
|
|
assert.match(分流, /保留原文件的範圍、順序、相依、例外與驗收意義/);
|
|
assert.match(分流, /不刪除技術限制/);
|
|
assert.match(分流, /重新繪製成容易閱讀的圖片式視覺/);
|
|
assert.match(分流, /不把 Mermaid 原碼當成交付物/);
|
|
});
|
|
|
|
test('API 契約只在預覽或確認位置交付,不寫入目標 repo', () => {
|
|
assert.match(分流, /API 契約文件只能交付在預覽位置或使用者確認的位置/);
|
|
assert.match(分流, /不得寫入目標專案 repo/);
|
|
assert.match(分流, /不捏造網址/);
|
|
});
|