功能(打手端): 移动端个人中心新增添加提现信息入口
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import test from 'node:test'
|
||||
|
||||
async function readSource(relativePath: string) {
|
||||
return readFile(new URL(`../src/${relativePath}`, import.meta.url), 'utf8')
|
||||
}
|
||||
|
||||
test('移动端个人中心提供添加提现信息入口', async () => {
|
||||
const [mobileView, page] = await Promise.all([
|
||||
readSource('pages/worker/WorkerProfileMobileView.tsx'),
|
||||
readSource('pages/worker/WorkerProfilePage.tsx'),
|
||||
])
|
||||
|
||||
assert.ok(mobileView.includes('label="添加提现信息"'), '工具宫格必须有添加提现信息入口')
|
||||
assert.ok(mobileView.includes('onAddWithdrawalAccount'), '移动端必须接线添加提现信息回调')
|
||||
assert.ok(
|
||||
page.includes('onAddWithdrawalAccount={openWithdrawalAccountModal}'),
|
||||
'页面必须复用现有添加提现信息弹窗',
|
||||
)
|
||||
assert.ok(
|
||||
page.includes('withdrawalAccounts={withdrawalAccounts}'),
|
||||
'页面必须把提现账户传给移动端',
|
||||
)
|
||||
})
|
||||
|
||||
test('移动端账号详情展示提现信息与空状态入口', async () => {
|
||||
const mobileView = await readSource('pages/worker/WorkerProfileMobileView.tsx')
|
||||
|
||||
assert.ok(mobileView.includes('worker-profile-mobile-withdraw-block'))
|
||||
assert.ok(mobileView.includes('提现信息'))
|
||||
assert.ok(mobileView.includes('暂未添加提现信息'))
|
||||
assert.ok(mobileView.includes('formatWithdrawalAccountDesc'))
|
||||
})
|
||||
|
||||
test('两个渠道都已添加时点击入口提示联系客服', async () => {
|
||||
const page = await readSource('pages/worker/WorkerProfilePage.tsx')
|
||||
|
||||
assert.ok(page.includes('支付宝和微信提现信息均已添加,修改请联系客服处理'))
|
||||
})
|
||||
|
||||
test('添加提现信息成功后只关闭弹窗,不自动打开提现申请', async () => {
|
||||
const page = await readSource('pages/worker/WorkerProfilePage.tsx')
|
||||
const submitBlock = page.slice(
|
||||
page.indexOf('async function submitWithdrawalAccount'),
|
||||
page.indexOf('async function submitAlipayQrCode'),
|
||||
)
|
||||
|
||||
assert.ok(submitBlock.length > 0, '必须能找到添加提现信息的提交函数')
|
||||
assert.ok(submitBlock.includes('setWithdrawalAccountOpen(false)'), '成功后必须关闭添加弹窗')
|
||||
assert.ok(!submitBlock.includes('setWithdrawOpen(true)'), '成功后不得自动打开提现申请弹窗')
|
||||
})
|
||||
Reference in New Issue
Block a user