From 0254c3abe1d6ca227d092b4cf7e9eefd60590839 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Tue, 22 Sep 2026 15:06:25 +0800 Subject: [PATCH] =?UTF-8?q?test(sdlc-feat-assets):=20=E8=A3=9C=E4=B8=8A?= =?UTF-8?q?=E4=BA=A4=E4=BB=98=E6=96=87=E4=BB=B6=E9=A0=90=E8=A6=BD=E6=AD=A3?= =?UTF-8?q?=E6=9C=AC=E6=B8=AC=E8=A9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 驗證文件待辦分流、預覽能力判斷、逐題詢問、ELI5 與平台中立邊界。 --- test/sdlc-feat-assets.test.js | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/sdlc-feat-assets.test.js diff --git a/test/sdlc-feat-assets.test.js b/test/sdlc-feat-assets.test.js new file mode 100644 index 0000000..37e3c9a --- /dev/null +++ b/test/sdlc-feat-assets.test.js @@ -0,0 +1,70 @@ +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(分流, /不捏造網址/); +});