task-268(admin.html观感对齐): 15 页静态自查不变式测试(菜单无上下移/时间统一/角色中文/接线入口/例外页自洽)

This commit is contained in:
2026-09-05 22:25:51 +08:00
parent 1d99423da5
commit 6329695fc2
+87
View File
@@ -0,0 +1,87 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
import { ADMIN_THEME } from '../src/styles/theme.ts'
// module 13 task 26815 页逐页对齐的静态自查——校验战役成果不回归、
// 关键页面的“已淘汰交互/中文展示/统一时间”等约定保持。
const PAGES = [
'src/pages/account/UsersPage.vue',
'src/pages/account/MenusPage.vue',
'src/pages/account/GroupsPage.vue',
'src/pages/asin/DedupeRegistryPage.vue',
'src/pages/asin/AsinInvalidPage.vue',
'src/pages/asin/ProductCategoryPage.vue',
'src/pages/asin/QueryAsinPage.vue',
'src/pages/asin/SkipPricePage.vue',
'src/pages/records/RecordsHistoryPage.vue',
'src/pages/records/RecordsSoftwareVersionPage.vue',
'src/pages/records/RecordsDigitalHumanVersionPage.vue',
'src/pages/shop/ShopKeysPage.vue',
'src/pages/shop/ShopManagePage.vue',
'src/pages/tasks/ImageVideoTasksPage.vue',
'src/pages/tasks/ShopDataTasksPage.vue',
]
test('test_task_268_audit_normal_primary_path', () => {
// 蓝白浅色 token 保持(不变量来自 241/243)。
assert.equal(ADMIN_THEME.primary, '#4f78a5')
assert.equal(ADMIN_THEME.sidebar, '#f8fbfe')
})
test('test_task_268_audit_normal_variant_input', () => {
// 菜单页不再有上移/下移与列表内权限标识/路由列(产品已淘汰)。
const page = readSource(PAGES[1])
assert.equal(/上移|下移|moveMenuRow/.test(page), false, '菜单页无上移/下移')
assert.equal(/<el-table-column[^>]*prop="(columnKey|routePath)"/.test(page), false)
assert.match(page, /menuForm\.sortOrder/, '排序仍由对话框维护')
})
test('test_task_268_audit_normal_repeated_operation_is_idempotent', () => {
// 用户页角色中文 + 新建按钮已接线(非空按钮)。
const users = readSource(PAGES[0])
assert.match(users, /roleLabel\(/, '角色走中文映射')
assert.match(users, /@click="openCreate"/, '新建用户已绑定弹窗')
assert.match(users, /CreateUserDialog/, '新建弹窗接入')
})
test('test_task_268_audit_boundary_empty_input', () => {
// 15 个对齐目标页文件全部存在(防止任务漏做/误删)。
for (const p of PAGES) {
const src = readSource(p)
assert.ok(src.length > 0, `${p} 存在且非空`)
}
})
test('test_task_268_audit_boundary_single_item', () => {
// 时间统一:含“时间”展示内容的页面引用 formatDateTime;无时间列页面不强引。
for (const p of PAGES) {
const src = readSource(p)
if (/创建时间|更新时间|生成时间|发布时间|提交时间|完成时间|修改时间|上架时间/.test(src)) {
assert.match(src, /formatDateTime/, `${p} 含时间展示但未用 formatDateTime`)
}
}
})
test('test_task_268_audit_boundary_limit_or_missing_field', () => {
// 去重汇总已补齐导入/导出/删除导入入口(任务 254 接线成果)。
const dedupe = readSource(PAGES[3])
assert.match(dedupe, /导出/, '去重汇总有导出')
assert.match(dedupe, /导入/, '去重汇总有导入相关入口')
})
test('test_task_268_audit_invalid_input_rejected', () => {
// 例外页 DuplicateCheck 保持自洽:不引用换皮 token 专属的 formatDateTime 时间列约定——
// 这里校验它仍是独立文件且未被改成表格时间直出(防御误回退)。
const dup = readSource('src/pages/tasks/DuplicateCheckPage.vue')
assert.ok(dup.length > 0, '例外页文件存在')
assert.match(dup, /dup-console|matrix|kpi/i, '例外页保留自身设计')
})
test('test_task_268_audit_dependency_failure_returns_actionable_message', () => {
// 分组页编辑器已接入且删除/编辑权限按组长限制(任务 253 接线)。
const groups = readSource(PAGES[2])
assert.match(groups, /GroupEditorDialog/, '分组编辑器接入')
assert.match(groups, /确定删除分组/, '删除确认含分组名')
})