Files
crawler-plugin/admin-frontend-vue/tests/align-shop-data-cards.test.ts
T

33 lines
1.8 KiB
TypeScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
/** 对齐 admin.js:1819-1860 renderShopDataRecordTable:每条任务一张卡片(店铺名头 + 任务号/状态 + 分组/最新/国家/文件行 + 下载文件/删除)。 */
test('align_shop_data_cards_per_task', () => {
const page = readSource('src/pages/tasks/ShopDataTasksPage.vue')
// 每任务一张卡:以 resultRow 迭代渲染卡片(宫格分页后绑定 pagedResultRows),不再按店铺聚合。
assert.match(page, /v-for="row in pagedResultRows"/, '逐任务卡片渲染')
assert.doesNotMatch(page, /v-for="group in groups"/, '去掉按店铺聚合卡片')
// 卡片结构:店铺名头 + 任务号/状态 + 分组/最新/国家/文件 信息行 + 下载文件/删除。
assert.match(page, /任务 {{ row\.taskNo \|\| row\.resultId }}|任务 {{ row\.taskNo/, '卡片含任务号')
assert.match(page, />分组</, '卡片含分组行')
assert.match(page, />最新</, '卡片含最新行')
assert.match(page, />国家</, '卡片含国家行')
assert.match(page, />文件</, '卡片含文件行')
assert.match(page, /下载文件/, '按钮名对齐参考「下载文件」')
})
test('align_shop_data_cards_selection_semantics', () => {
const page = readSource('src/pages/tasks/ShopDataTasksPage.vue')
// 参考 selectable = file_ready && resultId>0(不附加终态约束)。
assert.match(page, /fileReady/, '可选依赖 fileReady')
assert.doesNotMatch(page, /fileReady && isTerminalStatus/, '可选不再附加终态约束')
assert.match(page, /全选可下载/, '全选语义保留')
})
test('align_shop_data_cards_empty_text', () => {
const page = readSource('src/pages/tasks/ShopDataTasksPage.vue')
assert.match(page, /暂无符合条件的店铺数据记录/, '空态文案对齐参考')
})