Files
order_site/apps/frontend/tests/customer-fulfillment-weibo-ui.test.ts
T
yml 019fbaa912 merge(douyu): 合入客户领取与直播账号履约
- 合入斗鱼客户资料收集、角色绑定和半自动履约工作台
- 合入事务 Outbox、签名 Webhook 与低频对账链路
- 合入双角色识别、绑定重置、取消释放账号和已分配状态修复
- 将斗鱼履约数据库变更合并为单个 171 迁移文件
- 更新拆分后的客户样式测试入口并适配最新 main 客户页样式
2026-11-18 11:10:04 +08:00

67 lines
2.6 KiB
TypeScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import test from 'node:test'
const source = readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx',
),
'utf8',
)
const layoutStyles = readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../src/styles/customer/layout.css'),
'utf8',
)
const weiboStyles = readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../src/styles/customer/platform/weibo.css'),
'utf8',
)
test('微博与虎牙共用同一套登录表单结构', () => {
assert.match(source, /const renderLoginForm = \(options: \{/)
assert.ok(source.includes("platformLabel: '虎牙'"))
assert.ok(source.includes("platformLabel: '微博'"))
assert.ok(!source.includes('customer-auth-tabs'))
assert.ok(!source.includes('SafetyCertificateOutlined'))
})
test('微博保留两种登录方式与全部原有提示', () => {
assert.ok(source.includes('改用二维码登录'))
assert.ok(source.includes('改用手机号登录'))
assert.ok(source.includes('smsMfaRequired'))
assert.ok(source.includes('如安全验证弹窗未出现'))
assert.ok(source.includes('CustomerPrivacyNote'))
assert.ok(source.includes('温馨提示:未成年人禁止下单'))
})
test('二维码切换与虎牙一致:直接切到扫码并发起登录', () => {
assert.ok(source.includes("setLoginMode('qr')"))
assert.ok(source.includes('void handleStartLogin()'))
})
test('微博订单卡只展示订单号/商品/平台/状态,不含游戏和角色名称', () => {
const weiboBranch = source.slice(
source.indexOf("if (task.platform === 'weibo')"),
source.indexOf('const zone = task.customerServerZone'),
)
assert.ok(weiboBranch.includes('<span>订单号</span>'))
assert.ok(weiboBranch.includes('<span>商品</span>'))
assert.ok(weiboBranch.includes('<span>平台</span>'))
assert.ok(weiboBranch.includes('<span>状态</span>'))
assert.ok(!weiboBranch.includes('角色名称'))
assert.ok(!weiboBranch.includes('游戏名称'))
})
test('客户登录/绑定页顶部统一显示 inside-kv 背景,不再按平台区分', () => {
assert.match(
layoutStyles,
/\.customer-auth-hero \{[^}]*url\('\/images\/customer\/inside-kv\.jpg'\)[^}]*\}/s,
)
assert.ok(!weiboStyles.includes('.customer-auth-page.is-weibo .customer-auth-hero'))
assert.ok(!layoutStyles.includes('.customer-auth-page.is-huya .customer-auth-hero'))
assert.ok(weiboStyles.includes('.customer-auth-page.is-weibo .customer-auth-brand'))
})