63 lines
2.4 KiB
TypeScript
63 lines
2.4 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 styles = readFileSync(
|
|
join(dirname(fileURLToPath(import.meta.url)), '../src/styles/client.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(
|
|
styles,
|
|
/\.customer-auth-hero \{[^}]*url\('\/images\/customer\/inside-kv\.jpg'\)[^}]*\}/s,
|
|
)
|
|
assert.ok(!styles.includes('.customer-auth-page.is-weibo .customer-auth-hero'))
|
|
assert.ok(!styles.includes('.customer-auth-page.is-huya .customer-auth-hero'))
|
|
assert.ok(styles.includes('.customer-auth-page.is-weibo .customer-auth-brand'))
|
|
})
|