修复(半自动履约): 收口虎牙绑定为单一状态机
This commit is contained in:
@@ -11,15 +11,15 @@ const source = readFileSync(
|
||||
)
|
||||
const styles = readFileSync(join(root, '../src/styles/customer/binding.css'), 'utf8')
|
||||
|
||||
test('资料不一致时不自动弹核对框,由页面两个按钮处理', () => {
|
||||
assert.ok(source.includes("if (bindingInfo.comparison.verdict !== 'match') return"))
|
||||
assert.ok(source.includes('不一致时不弹框'))
|
||||
// 手动刷新时也只有三项一致才打开核对框。
|
||||
assert.ok(source.includes("if (nextBinding?.comparison?.verdict === 'match') {"))
|
||||
test('只有唯一绑定决策允许时才自动弹核对框', () => {
|
||||
assert.ok(source.includes('if (!bindingDecision?.canConfirmBinding) return'))
|
||||
assert.ok(source.includes('if (nextDecision?.canConfirmBinding) {'))
|
||||
assert.ok(!source.includes("bindingInfo.comparison.verdict === 'match'"))
|
||||
})
|
||||
|
||||
test('资料不一致时固定提供重新扫码换绑与上一步修改资料', () => {
|
||||
assert.ok(source.includes('showRebindFailure || comparisonMismatch'))
|
||||
assert.ok(source.includes('decisionRequiresRebind || decisionCanRefreshQr'))
|
||||
assert.ok(source.includes('decisionCanEditProfile'))
|
||||
assert.ok(source.includes('重新扫码换绑'))
|
||||
assert.ok(source.includes('上一步修改资料'))
|
||||
assert.ok(source.includes('onClick={() => void openProfileEditor()}'))
|
||||
@@ -36,7 +36,7 @@ test('保存资料后只由单一自动绑定流程推进,不再并发轮询',
|
||||
const saveBody = source.slice(saveStart, saveStart + 1800)
|
||||
assert.ok(!saveBody.includes('pollCustomerBinding('))
|
||||
assert.ok(source.includes("message.success('资料已保存,正在重新核对平台角色')"))
|
||||
assert.ok(source.includes("if (selectedTask.bindingStatus !== 'not_started'"))
|
||||
assert.ok(source.includes("!['query_binding', 'start_first_binding'].includes"))
|
||||
})
|
||||
|
||||
test('登录和绑定专用同步阶段暂停整单轮询', () => {
|
||||
@@ -48,7 +48,7 @@ test('登录和绑定专用同步阶段暂停整单轮询', () => {
|
||||
|
||||
test('角色名和区服一致才出现确认绑定,不一致时展示原因', () => {
|
||||
assert.ok(source.includes('确认绑定此角色'))
|
||||
assert.ok(source.includes("bindingComparison?.verdict === 'match'"))
|
||||
assert.ok(source.includes('canConfirmDecision'))
|
||||
assert.ok(source.includes('两侧角色信息不一致,无法提交平台绑定'))
|
||||
assert.ok(source.includes('customer-binding-modal-error'))
|
||||
})
|
||||
@@ -65,7 +65,8 @@ test('二维码区明确区分虎牙账号 UID 与游戏角色 UID', () => {
|
||||
|
||||
test('换绑流程刷新二维码必须带 forceRebind,避免直接返回已有角色', () => {
|
||||
assert.ok(source.includes('function handleRefreshBindingQr()'))
|
||||
assert.ok(source.includes('handleRefreshBinding(bindingInfo?.rebindRequested === true)'))
|
||||
assert.ok(source.includes("bindingDecision?.primaryAction === 'start_rebind'"))
|
||||
assert.ok(source.includes("bindingDecision?.primaryAction === 'refresh_rebind_qr'"))
|
||||
// 三处刷新/重新获取入口都不能再固定传 false。
|
||||
assert.ok(!source.includes('handleRefreshBinding(false)'))
|
||||
assert.ok(source.includes('onClick={handleRefreshBindingQr}'))
|
||||
|
||||
@@ -13,7 +13,8 @@ const source = readFileSync(
|
||||
)
|
||||
|
||||
test('换绑失败页提供重新扫码换绑与上一步修改资料,不再直接使用原角色', () => {
|
||||
assert.ok(source.includes('showRebindFailure || comparisonMismatch'))
|
||||
assert.ok(source.includes('decisionRequiresRebind || decisionCanRefreshQr'))
|
||||
assert.ok(source.includes('decisionCanEditProfile'))
|
||||
assert.ok(source.includes('重新扫码换绑'))
|
||||
assert.ok(source.includes('上一步修改资料'))
|
||||
assert.ok(!source.includes('确认使用原角色'))
|
||||
@@ -22,7 +23,7 @@ test('换绑失败页提供重新扫码换绑与上一步修改资料,不再
|
||||
})
|
||||
|
||||
test('换绑后仍不一致时以修改资料为主,同时保留重新扫码入口', () => {
|
||||
const panelStart = source.indexOf('showRebindFailure || comparisonMismatch')
|
||||
const panelStart = source.indexOf('className="customer-binding-role-actions"')
|
||||
assert.ok(panelStart > 0)
|
||||
const panel = source.slice(panelStart, panelStart + 1600)
|
||||
assert.ok(panel.includes('重新扫码换绑'))
|
||||
@@ -52,7 +53,8 @@ test('上一步修改资料会清空换绑状态并保留已填资料', () => {
|
||||
assert.ok(source.includes('setBindingInfo(response.data.binding)'))
|
||||
assert.ok(source.includes("message.success('已返回上一步,请修改资料后重新提交')"))
|
||||
// 已登录且有绑定结果时才重置,资料表单本身不受影响。
|
||||
assert.ok(source.includes("selectedTask.bindingStatus === 'not_started'"))
|
||||
assert.ok(source.includes("bindingDecision?.flowState === 'binding_query_required'"))
|
||||
assert.ok(source.includes("bindingDecision?.flowState === 'initial_bind_required'"))
|
||||
// 重置失败不阻断客户修改资料。
|
||||
assert.ok(source.includes('重置绑定状态失败,请稍后重试'))
|
||||
})
|
||||
@@ -66,8 +68,6 @@ test('刷新二维码有 3 秒冷却并提示操作频繁', () => {
|
||||
assert.ok(source.includes('lastBindingRefreshAtRef.current = now'))
|
||||
// 冷却判断必须在真正发起 startCustomerBinding 之前。
|
||||
const guardIndex = source.indexOf('操作频繁,请稍后再试')
|
||||
const startIndex = source.indexOf(
|
||||
'await startCustomerBinding(orderNo, selectedTask.id, { forceRebind })',
|
||||
)
|
||||
const startIndex = source.indexOf('await startCustomerBinding(orderNo, selectedTask.id, {')
|
||||
assert.ok(guardIndex > 0 && startIndex > guardIndex)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user