60 lines
3.0 KiB
TypeScript
60 lines
3.0 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
|
|
// module 13 task 263:店铺管理页对齐 admin panel-shop-manage(分组/店铺名筛选、密码掩码+眼睛
|
|
// 实时读取、修改时间列、必填校验整句、编辑密码必填语义、删除确认、凭证明文弹窗复制)。
|
|
|
|
test('test_task_263_shop_manage_normal_primary_path', () => {
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /分组/, '需有分组列/分组筛选')
|
|
assert.match(page, /店铺名称/, '需有店铺名称筛选')
|
|
assert.match(page, /shopName/, '店铺名筛选绑定 shopName')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_normal_variant_input', () => {
|
|
// 密码列:掩码默认,提供眼睛实时读取与隐藏。
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /togglePassword/, '需有眼睛切换密码读取')
|
|
assert.match(page, /shownPassword/, '密码展示经 shownPassword')
|
|
assert.match(page, /读取中\.\.\./, '读取中有占位')
|
|
assert.match(page, /\*\*\*\*\*\*/, '掩码默认 ******')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_normal_repeated_operation_is_idempotent', () => {
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.ok((page.match(/formatDateTime/g) || []).length >= 1, '时间统一格式化')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_boundary_empty_input', () => {
|
|
// 必填整句校验(含编辑需重填密码的语义)。
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /请完整填写分组、店铺名、店铺商城名、账号、密码/, '必填校验需整句提示')
|
|
assert.match(page, /后端必填,编辑请重新填写登录密码/, '编辑密码占位不再自相矛盾')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_boundary_single_item', () => {
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /updatedAt/, '需含修改时间列')
|
|
assert.match(page, /创建时间/, '保留创建时间列')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_boundary_limit_or_missing_field', () => {
|
|
// 分组下拉来源 fetchShopManageGroups。
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /fetchShopManageGroups/, '分组下拉走分组接口')
|
|
assert.match(page, /credential/, '凭证明文/复制能力在位')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_invalid_input_rejected', () => {
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /确定删除店铺“/, '删除确认需含“确定删除店铺”')
|
|
})
|
|
|
|
test('test_task_263_shop_manage_dependency_failure_returns_actionable_message', () => {
|
|
// 密码列含明文时不脱离 fetch credential 适配层(不内联请求)。
|
|
const page = readSource('src/pages/shop/ShopManagePage.vue')
|
|
assert.match(page, /fetchShopCredential/, '明文经 fetchShopCredential 获取')
|
|
assert.equal(/http\.(get|post|put|delete)/.test(page), false, '页面不内联 HTTP 请求')
|
|
})
|