31 lines
1.0 KiB
TypeScript
31 lines
1.0 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',
|
|
)
|
|
|
|
test('换绑失败且资料不一致时提供修改资料与同步入口', () => {
|
|
assert.ok(source.includes('bindingProfileMismatch'))
|
|
assert.ok(source.includes('修改资料,使用原角色'))
|
|
assert.ok(source.includes('同步平台角色并继续'))
|
|
assert.ok(source.includes('openProfileEditor'))
|
|
})
|
|
|
|
test('资料不一致时前置拦截仍使用原角色与重新提交换绑', () => {
|
|
assert.ok(source.includes("bindingInfo?.comparison?.verdict === 'mismatch'"))
|
|
assert.ok(source.includes('请先修改资料'))
|
|
})
|
|
|
|
test('修改资料复用现有内嵌表单', () => {
|
|
assert.ok(source.includes('id="customer-profile-form"'))
|
|
assert.ok(source.includes('setProfileEditing(true)'))
|
|
})
|