Files
crawler-plugin/admin-frontend-vue/tests/task-250.test.ts
T
huangzd1997 10dec12ec0 refactor(前端): 前后台界面小字全面精简——删技术ID括号/页头操作提示条/机制解释句(2026-11-28 客户口径「这些小字都不需要多余,还有shopId啥的…除了必须要的比如任务ID密钥,其他精简一些」)
用户端 frontend-vue:
- jd-publish-shop.ts:shopLabel 只出店名(缺名兜底「店铺 N」),跨店/多店琥珀文案压成一两句,判据逻辑零改动
- JdPublishTab:删工具头/分类解释/品牌句后半,默认店铺/选品/collect-hint/中断回执/加价规则各压一句
- JdCollectTab:删工具头 desc、分类机制句、断点游标行,「页面筛选未生效兜底翻页中」从任务卡撤下
- jd-on-shelf 空态一句、JdConsolePage hero-sub 整段删(含过时的「正在建设中」)
- 品牌 10 个 tab:输入/筛选/加载长句压一句或删,任务卡删「结果ID/店铺ID/平台」技术行(店名已显形)
- 保留:错误出口、额度「当前在架X/Y」、GROUPS_EMPTY 空态动作句、检测按钮与店铺显形

后管 admin-frontend-vue:
- 每页顶部「当前页面操作提示」条整条下线(删 OperationGuide.vue+operation-guides.ts)
- 撞款/任务中心/关键词用量/密钥用量/客户端包/教程/软件版本/数字人/菜单/店铺密钥/登录页逐页删说明小字(保留:踢线警示、「留空=永不过期」、「不要带v前缀」、「仅支持.zip」、草稿需手动发布、已授权人数、安全提示)
- 编辑/建号弹窗 label 括号收短;代理弹窗/设备日志(删 pywebview/kk-browser 进程名)/密钥 pill title/授权弹窗 dim/品牌门控空态收短

测试同步(16 支改反钉或同步断言,全部当场绿):
- align-operation-guide 整份重写为反钉(组件与文案表不得回流)
- source-pin 台账 task-center-board 条目手工点名 7/3/5→24/14/28:旧值是切分器把正则字面量内裸引号当字符串开关吞掉 18 支用例的误量(stripNonCode 不识别 regex literal),本次改写恰好移除该文件最后两处带引号正则后测出真值;真实用例数反而 25→24(删 1 支 guide 用例),非真实增长

门禁:后管 node --test 1965/1965+vitest 253/253+vue-tsc rc=0;用户端 node 1150/mount 149/vue-tsc rc=0;ops 快检 --fast overall=pass(后端9.5/后管8.8/客户端9.8/用户端9.6)。本窗不发版;app_client/jar/后端零改动。
2026-11-28 01:14:51 +08:00

69 lines
3.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
import { createUserFilterState, toUserListParams } from '../src/pages/account/users-filter.ts'
import { deleteConfirmMessage } from '../src/pages/account/user-delete-model.ts'
// module 13 task 250:用户管理列表页对齐 admin panel-users(页头描述/筛选含所属管理员/角色中文/分页)。
test('test_task_250_users_list_normal_primary_path', () => {
const page = readSource('src/pages/account/UsersPage.vue')
assert.match(page, /roleLabel/, '角色列需走中文 roleLabel 映射')
assert.match(page, /所属管理员/, '需展示“所属管理员”列/筛选项')
assert.doesNotMatch(page, /开放注册/, '页头说明已按精简口径删除(2026-11-28)')
})
test('test_task_250_users_list_normal_variant_input', () => {
// 正常变体:删除确认与不可删原因复用用户模型文案。
const page = readSource('src/pages/account/UsersPage.vue')
assert.match(page, /deleteConfirmMessage/, '删除确认应复用 deleteConfirmMessage')
assert.match(page, /deleteBlockReason/, '不可删原因应复用 deleteBlockReason')
assert.match(page, /creatorUsername/, '列表应含所属管理员列')
})
test('test_task_250_users_list_normal_repeated_operation_is_idempotent', () => {
// 筛选映射:createdByAdminId -> created_by_id。
const state = { ...createUserFilterState(), createdByAdminId: 7 }
const params = toUserListParams(state)
assert.equal(params.createdById, 7)
const plain = toUserListParams(createUserFilterState())
assert.equal(plain.createdById, null)
})
test('test_task_250_users_list_boundary_empty_input', () => {
// 边界:空结果应有明确空态占位。
const page = readSource('src/pages/account/UsersPage.vue')
assert.match(page, /el-empty|暂无用户|userListEmptyHint|empty-text/, '空态需有用户可读提示')
})
test('test_task_250_users_list_boundary_single_item', () => {
// 边界:分页/合计形态为“共 N 条”,查询后回第一页。
const page = readSource('src/pages/account/UsersPage.vue')
assert.match(page, /OldPagination/, '分页走共享组件')
const comp = readSource('src/components/OldPagination.vue')
assert.match(comp, /共 \{\{ total \}\} 条/, '共享分页含“共 N 条”合计')
assert.match(page, /filters\.page = 1/, '查询需重置回第一页')
})
test('test_task_250_users_list_boundary_limit_or_missing_field', () => {
// 边界上限:所属管理员筛选仅超管可见(非超管隐藏)。
const page = readSource('src/pages/account/UsersPage.vue')
assert.match(page, /isSuperAdmin|super_admin|createdByAdminId/, '需按超管身份控制管理员筛选项')
assert.ok(deleteConfirmMessage({ id: 1, username: 'demo', role: 'normal' }).includes('确定删除用户 "demo" 吗?'))
})
test('test_task_250_users_list_invalid_input_rejected', () => {
// 异常:不得再直出英文角色码(已改中文)。
const page = readSource('src/pages/account/UsersPage.vue')
assert.equal(/prop="role"/.test(page), false, '角色列不得再直出 prop=role 英文')
assert.equal(/admin-user-role/.test(page), false)
})
test('test_task_250_users_list_dependency_failure_returns_actionable_message', () => {
// 依赖:列表响应解析 admins(供所属管理员下拉)。
const model = readSource('src/api/users-model.ts')
assert.match(model, /record\.admins/, 'users-model 需解析 admins')
const dto = readSource('src/api/users-dto.ts')
assert.match(dto, /admins\?:/, 'DTO 需声明 admins')
})