chore(清理): 删除 10 个零引用文件并裁剪钉住它们的护栏断言

admin-frontend-vue:AdminConfirm.vue 只是 openAdminConfirm 的空壳包装(调用方走
imperative 入口);StatusPill/ModalShell/DrawerShell 与各自的 status-pill-model、
modal-model 构成孤儿岛,无任何页面 import;MaskReveal.vue 无引用点(掩码语义仍由
店铺侧 secret-mask 承担);duplicate-api.ts 是被 duplicate-console-api.ts 取代的
平行实现,DuplicateCheckPage 只用后者。frontend-vue:shared/utils/bootstrap.ts 全仓零命中。

护栏随之收口:task-248.test.ts 整支删除(8 个用例全在钉 modal-model 与两个 Shell),
task-247 去掉 status-pill-model 的 6 个用例与三个组件的钉(保留 CopyText/copy-model),
task-245 去掉 AdminConfirm.vue 的两行,task-115/117/118 去掉 duplicate-api.ts 的端点钉。
This commit is contained in:
2026-10-06 13:44:41 +08:00
parent fcb7fca0b0
commit 5bc886f14d
16 changed files with 7 additions and 476 deletions
+2 -54
View File
@@ -1,55 +1,9 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
import { pillToneStyle, PILL_TONES, statusTone, type PillTone } from '../src/components/status-pill-model.ts'
import { copyFeedback } from '../src/components/copy-model.ts'
// module 13 task 247:行内工具组件化 —— 状态药丸/复制文本/掩码揭示,供视频/店铺数据/
// 数字人版本等页面复用;掩码复用店铺中心 secret-mask 语义。
test('test_task_247_pill_model_normal_primary_path', () => {
// 正常主路径:状态文本 → 语义 tone。
assert.equal(statusTone('SUCCESS'), 'success')
assert.equal(statusTone('FAILED'), 'danger')
assert.equal(statusTone('已发布'), 'success')
assert.equal(statusTone('失败'), 'danger')
})
test('test_task_247_pill_model_normal_variant_input', () => {
// 正常变体:运行/草稿等中间态落 warning;未知回落 info。
assert.equal(statusTone('RUNNING'), 'warning')
assert.equal(statusTone('草稿'), 'warning')
assert.equal(statusTone('something-unknown'), 'info')
})
test('test_task_247_pill_model_normal_repeated_operation_is_idempotent', () => {
assert.equal(statusTone('SUCCESS'), statusTone('success'))
assert.deepEqual(pillToneStyle('success'), pillToneStyle('success'))
})
test('test_task_247_pill_model_boundary_empty_input', () => {
// 边界空:空值/未知名不崩溃。
assert.equal(statusTone(''), 'info')
assert.equal(statusTone(undefined as unknown as string), 'info')
})
test('test_task_247_pill_model_boundary_single_item', () => {
// 边界单元素:每个 tone 都有可读配色(药丸文字/底色为 admin 三态色)。
for (const tone of Object.keys(PILL_TONES) as PillTone[]) {
const s = pillToneStyle(tone)
assert.match(s.text, /^#[0-9a-f]{6}$/)
assert.match(s.bg, /^#[0-9a-f]{6}$/)
}
assert.equal(pillToneStyle('success').text, '#4e806d')
assert.equal(pillToneStyle('danger').text, '#b35f6a')
})
test('test_task_247_pill_model_invalid_input_rejected', () => {
// 异常输入:非法 tone 回退 info,不抛错;三态主色与 admin 语义一致。
assert.equal(pillToneStyle('bogus' as PillTone).text, PILL_TONES.info.text)
assert.equal(PILL_TONES.warning.text, '#a8793e')
assert.equal(PILL_TONES.info.text, '#4f78a5')
})
// module 13 task 247:行内工具组件化 —— 复制文本,供视频/店铺数据/数字人版本等页面复用。
test('test_task_247_copy_model_boundary_limit_or_missing_field', () => {
// 复制反馈:非空给「已复制 X」,空/失败给降级文案。
@@ -59,15 +13,9 @@ test('test_task_247_copy_model_boundary_limit_or_missing_field', () => {
})
test('test_task_247_components_dependency_failure_returns_actionable_message', () => {
// 依赖失败:组件真实存在且接入语义(药丸用 PILL_TONES、复制走 copyFeedback、掩码复用 secret-mask)。
assert.ok(readSource('src/components/StatusPill.vue').length > 0)
// 依赖失败:CopyText 真实存在且复制文案走 copyFeedback。
assert.ok(readSource('src/components/CopyText.vue').length > 0)
assert.ok(readSource('src/components/MaskReveal.vue').length > 0)
const copy = readSource('src/components/CopyText.vue')
assert.match(copy, /copyFeedback/)
assert.match(copy, /navigator\.clipboard/)
const mask = readSource('src/components/MaskReveal.vue')
assert.match(mask, /secret-mask|secretPlaceholder|SECRET_PLACEHOLDER/, '掩码应复用店铺 secret-mask 语义')
const pill = readSource('src/components/StatusPill.vue')
assert.match(pill, /pillToneStyle|PILL_TONES/, '药丸应使用统一配色模型')
})