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

40 lines
2.3 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'
/** 对齐 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"/, '去掉按店铺聚合卡片')
// 卡片结构:店铺名头 + 任务 id/状态 + 分组/最新/国家/文件 信息行 + 下载文件/删除。
assert.match(page, /任务 {{ row\.taskId \|\| row\.taskNo \|\| row\.resultId }}/, '卡片显示任务 idfile_task.id 短数字,与桌面端一致)')
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, /暂无符合条件的店铺数据记录/, '空态文案对齐参考')
})
test('align_shop_data_permission_table_pagination', () => {
// 权限配置弹窗用户表全量渲染无分页:补共享 OldPagination10/20/50/100)。
const page = readSource('src/pages/tasks/ShopDataTasksPage.vue')
assert.match(page, /:data="pagedPermissionItems"/, '权限表绑定分页切片')
assert.match(page, /:total="permissionItems\.length"/, '权限表有分页器')
})