73 lines
3.7 KiB
TypeScript
73 lines
3.7 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
|
|
// module 13 task 254:去重汇总页对齐 admin panel-dedupe-total-data —— 筛选扩充(用户名/分组/日期)、
|
|
// 行编辑/删除、新增导入/删除导入(轮询)、导出(日期校验+等待) 接线既有孤儿模块。
|
|
|
|
test('test_task_254_dedupe_normal_primary_path', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.match(page, /新增导入/, '页头需有新增导入按钮')
|
|
assert.match(page, /删除导入/, '页头需有删除导入按钮')
|
|
assert.match(page, /导出/, '页头需有导出入口')
|
|
assert.match(page, /编辑/, '行内需有编辑操作')
|
|
assert.match(page, /删除/, '行内需有删除操作')
|
|
})
|
|
|
|
test('test_task_254_dedupe_normal_variant_input', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.match(page, /fetchDedupeTotalGroups/, '需接线分组列表源')
|
|
assert.match(page, /toDedupeListParams/, '需走共享筛选归一(dedupe-total-filter)')
|
|
assert.match(page, /importFinished|importTaskFinished/, '需用导入终态判断停止轮询')
|
|
assert.match(page, /importOutcomeText/, '需展示导入/删除进度文案')
|
|
})
|
|
|
|
test('test_task_254_dedupe_normal_repeated_operation_is_idempotent', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.ok(page.includes('新增导入'))
|
|
assert.ok(page.includes('新增导入'))
|
|
})
|
|
|
|
test('test_task_254_dedupe_boundary_empty_input', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.match(page, /开始日期/, '筛选需含开始日期')
|
|
assert.match(page, /结束日期/, '筛选需含结束日期')
|
|
assert.match(page, /上传人|用户名/, '筛选需含用户名')
|
|
assert.match(page, /分组/, '筛选需含分组下拉')
|
|
assert.match(page, /国家/, '筛选需含国家下拉')
|
|
})
|
|
|
|
test('test_task_254_dedupe_boundary_single_item', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.match(page, /开始日期不能晚于结束日期|晚于结束日期/, '导出需做日期区间校验')
|
|
assert.match(page, /确定删除总数据/, '行删除确认文案应对齐 admin')
|
|
})
|
|
|
|
test('test_task_254_dedupe_boundary_limit_or_missing_field', () => {
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
assert.match(page, /\.xlsx|\.xls|xlsx/, '导入需 Excel 文件类型提示')
|
|
assert.match(page, /mounted|onMounted/, '需首屏加载')
|
|
})
|
|
|
|
test('test_task_254_dedupe_invalid_input_rejected', () => {
|
|
// 异常:不得出现空操作按钮(无 @click 的页头主按钮)。
|
|
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
|
const headerButtons = page.match(/type="primary"[^>]*>([^<]*?)</g) ?? []
|
|
for (const btn of headerButtons) {
|
|
const label = btn.match(/>([^<]*?)</)?.[1] ?? ''
|
|
if (/导入|导出/.test(label)) {
|
|
assert.ok(page.includes(`openImport`), `导入类按钮必须绑定 @click (${label})`)
|
|
}
|
|
}
|
|
})
|
|
|
|
test('test_task_254_dedupe_dependency_failure_returns_actionable_message', () => {
|
|
// 依赖失败:api 模块须暴露单行更新/删除端点;导入/删除导入复用既有常量(防假接线)。
|
|
const api = readSource('src/pages/asin/dedupe-total-api.ts')
|
|
assert.match(api, /updateDedupeTotal|method: 'PUT'|\.put</, '需支持行编辑 PUT')
|
|
assert.match(api, /deleteDedupeTotal|\.delete</, '需支持行删除 DELETE')
|
|
const importApi = readSource('src/pages/asin/dedupe-import-api.ts')
|
|
assert.match(importApi, /DEDUPE_IMPORT_ENDPOINT/, '需复用导入端点常量')
|
|
assert.match(importApi, /DEDUPE_DELETE_IMPORT_ENDPOINT/, '需复用删除导入端点常量')
|
|
})
|