Files

57 lines
2.6 KiB
TypeScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
// module 13 task 257:查询ASIN页对齐 admin panel-query-asin —— 行内「配置」抽屉(逐国 ASIN,
// 留空=删除该站点)、导入添加/删除导入/导出接线既有孤儿模块。
test('test_task_257_queryasin_normal_primary_path', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /updateQueryAsinCountryAsin/, '需接线逐国 PUT')
assert.match(page, /deleteQueryAsinCountryAsin/, '需接线逐国 DELETE')
assert.match(page, /配置/, '行内需有配置入口')
assert.match(page, /留空表示删除该站点已有的 ASIN/, '抽屉需留空=删除语义提示')
})
test('test_task_257_queryasin_normal_variant_input', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /导入添加/, '页头需导入添加')
assert.match(page, /导入删除/, '页头需删除导入')
assert.match(page, /导出/, '页头需导出')
})
test('test_task_257_queryasin_normal_repeated_operation_is_idempotent', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.ok(page.includes('配置'))
assert.ok(page.includes('配置'))
})
test('test_task_257_queryasin_boundary_empty_input', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /startQueryAsinImport|startQueryAsinDeleteImport|fetchQueryAsinImportProgress|fetchQueryAsinDeleteImportProgress/, '导入需启动+轮询')
assert.match(page, /isAllowedExcelImportFile|isAllowedImportFile/, '导入需 Excel 校验')
})
test('test_task_257_queryasin_boundary_single_item', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /toUpperCase/, 'ASIN 需自动大写')
assert.match(page, /query-asins\/export|export/, '需导出能力')
})
test('test_task_257_queryasin_boundary_limit_or_missing_field', () => {
const api = readSource('src/pages/asin/query-asin-detail-api.ts')
assert.match(api, /\/countries\//, '详情 API 需按国家细分')
assert.match(api, /method: 'PUT'|\.put</, '详情需 PUT')
})
test('test_task_257_queryasin_invalid_input_rejected', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /请选择|文件/, '导入需分组/文件必填提示')
assert.match(page, /确定按 Excel|批量删除/, '删除导入需前置确认')
})
test('test_task_257_queryasin_dependency_failure_returns_actionable_message', () => {
const page = readSource('src/pages/asin/QueryAsinPage.vue')
assert.match(page, /drawer|el-drawer/, '配置承载宜用抽屉')
})