feat(semi-auto): 补充扫码角色对比入口并修复换绑二维码刷新
- 扫码识别角色后资料不一致也打开对比弹窗,支持修改资料/同步平台角色 - 保存资料或同步角色后自动重新打开对比弹窗 - 换绑流程刷新二维码传 forceRebind,避免直接返回已有角色
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
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 root = dirname(fileURLToPath(import.meta.url))
|
||||
const source = readFileSync(
|
||||
join(root, '../src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx'),
|
||||
'utf8',
|
||||
)
|
||||
const styles = readFileSync(join(root, '../src/styles/client.css'), 'utf8')
|
||||
|
||||
test('扫码识别角色后,资料不一致也打开对比弹窗', () => {
|
||||
// 自动弹窗 effect 不再因 mismatch 提前 return。
|
||||
assert.ok(source.includes('识别到角色(含与资料不一致)都要弹出对比框'))
|
||||
assert.ok(!source.includes("if (bindingInfo.comparison.verdict === 'mismatch') return"))
|
||||
// 手动刷新时 mismatch 同样打开弹窗,不再关闭并只弹提示。
|
||||
assert.ok(source.includes('资料不一致同样打开对比框'))
|
||||
assert.ok(!source.includes('平台角色与已填资料不一致,请先同步资料'))
|
||||
})
|
||||
|
||||
test('对比弹窗在资料不一致时提供修改资料与同步平台角色入口', () => {
|
||||
assert.ok(source.includes('修改资料'))
|
||||
assert.ok(source.includes('同步平台角色'))
|
||||
assert.ok(source.includes('canSyncBindingProfile'))
|
||||
assert.ok(source.includes('onClick={openProfileEditor}'))
|
||||
assert.ok(
|
||||
source.includes(
|
||||
"disabled={!bindingCustomerReady || bindingComparison?.verdict === 'mismatch'}",
|
||||
),
|
||||
)
|
||||
assert.ok(styles.includes('.customer-binding-modal-actions.is-mismatch'))
|
||||
assert.ok(styles.includes('repeat(auto-fit, minmax(140px, 1fr))'))
|
||||
})
|
||||
|
||||
test('保存资料或同步平台角色后会重新打开对比弹窗', () => {
|
||||
assert.ok(source.includes('function reopenBindingConfirm('))
|
||||
assert.ok(source.includes("if (nextTask.bindingStatus !== 'role_ready') return false"))
|
||||
assert.ok(source.includes('reopened = reopenBindingConfirm('))
|
||||
assert.ok(
|
||||
source.includes(
|
||||
'reopenBindingConfirm(bindingResponse.data.task, bindingResponse.data.binding)',
|
||||
),
|
||||
)
|
||||
assert.ok(source.includes('角色资料已保存,请重新核对绑定角色'))
|
||||
})
|
||||
|
||||
test('资料不一致时仍保持后端严格比对:确认按钮禁用并显示原因', () => {
|
||||
assert.ok(source.includes('两侧角色信息不一致,无法确认绑定'))
|
||||
assert.ok(source.includes('customer-binding-modal-error'))
|
||||
})
|
||||
|
||||
test('二维码区提示扫码后会核对平台角色与已填资料', () => {
|
||||
assert.ok(source.includes('扫码后系统会核对平台角色与已填资料'))
|
||||
})
|
||||
|
||||
test('换绑流程刷新二维码必须带 forceRebind,避免直接返回已有角色', () => {
|
||||
assert.ok(source.includes('function handleRefreshBindingQr()'))
|
||||
assert.ok(source.includes('handleRefreshBinding(bindingInfo?.rebindRequested === true)'))
|
||||
// 三处刷新/重新获取入口都不能再固定传 false。
|
||||
assert.ok(!source.includes('handleRefreshBinding(false)'))
|
||||
assert.ok(source.includes('onClick={handleRefreshBindingQr}'))
|
||||
})
|
||||
Reference in New Issue
Block a user