Files
crawler-plugin/admin-frontend-vue/tests/task-258.test.ts
T

58 lines
2.8 KiB
TypeScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
// module 13 task 258:最低价ASIN页对齐 admin panel-skip-price-asin —— 价格范围筛选生效、
// 行内「配置」抽屉(逐国 ASIN+最低价,留空=删除、低价必带 ASIN 校验)、导入添加/删除导入/导出。
test('test_task_258_skipprice_normal_primary_path', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /updateSkipPriceCountry/, '需接线逐国 PUT(ASIN+最低价)')
assert.match(page, /deleteSkipPriceCountry/, '需接线逐国 DELETE')
assert.match(page, /配置/, '行内需配置入口')
assert.match(page, /留空表示删除该站点/, '抽屉需留空删除语义')
})
test('test_task_258_skipprice_normal_variant_input', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /填写最低价时必须填写 ASIN/, '低价必带 ASIN 校验文案')
assert.match(page, /最低价格式不正确/, '低价格式校验文案')
assert.match(page, /导入文件新增/, '页头导入文件新增(旧版文案)')
assert.match(page, /导入文件删除/, '页头导入文件删除(旧版文案)')
assert.match(page, /导出 XLSX/, '页头导出 XLSX(旧版文案)')
})
test('test_task_258_skipprice_normal_repeated_operation_is_idempotent', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.ok(page.includes('配置'))
assert.ok(page.includes('最低价'))
})
test('test_task_258_skipprice_boundary_empty_input', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /startSkipPriceImport|fetchSkipPriceImportProgress/, '需接线导入添加')
assert.match(page, /toUpperCase/, 'ASIN 需自动大写')
assert.match(page, /minimumPriceFrom/, '价格范围筛选需保留')
})
test('test_task_258_skipprice_boundary_single_item', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /请选择分组|分组后再导入/, '导入需分组必选(后端必填)')
})
test('test_task_258_skipprice_boundary_limit_or_missing_field', () => {
const api = readSource('src/pages/asin/skip-price-detail-api.ts')
assert.match(api, /minimumPrice/, '详情 API 需含最低价')
})
test('test_task_258_skipprice_invalid_input_rejected', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /批量删除|确定按 Excel/, '删除导入需前置确认')
assert.match(page, /skip-price-asins\/export|导出/, '需导出能力')
})
test('test_task_258_skipprice_dependency_failure_returns_actionable_message', () => {
const page = readSource('src/pages/asin/SkipPricePage.vue')
assert.match(page, /toSkipPriceParams/, '筛选需含最低价区间归一')
})