feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* shared/api/client.stpErrors.spec.ts
|
||||
* 用途:锁定 STP 错误码四语言映射(UI-05 / BE-04)。
|
||||
* 依赖:vitest、vue-i18n、resolveLocalizedErrorMessage。
|
||||
* 逻辑:断言 SHIPPING.STP_* 不回落英文后端 message。
|
||||
*/
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
vi.mock('@/i18n', async () => {
|
||||
const { createI18n } = await import('vue-i18n');
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
errors: {
|
||||
generic: '通用错误',
|
||||
codes: {
|
||||
'SHIPPING.STP_RETRY_ALREADY_CONFIRMED': '该复核单已确认建单,请改用确认后自动推进重试。',
|
||||
'SHIPPING.STP_ENQUEUE_FAILED': '自动建单入队失败,请稍后重试或联系管理员。',
|
||||
'SHIPPING.STP_NOT_ELIGIBLE': '当前订单尚未满足自动建单条件,请先完成校验与门禁后再重试。',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return { default: i18n };
|
||||
});
|
||||
|
||||
describe('resolveLocalizedErrorMessage STP codes', () => {
|
||||
it('maps SHIPPING.STP_* codes to locale text instead of English fallback', async () => {
|
||||
const { resolveLocalizedErrorMessage } = await import('./client');
|
||||
expect(resolveLocalizedErrorMessage(
|
||||
'SHIPPING.STP_RETRY_ALREADY_CONFIRMED',
|
||||
'Case already confirmed; use post-confirm auto progress retry',
|
||||
)).toContain('已确认建单');
|
||||
expect(resolveLocalizedErrorMessage(
|
||||
'SHIPPING.STP_ENQUEUE_FAILED',
|
||||
'STP enqueue failed',
|
||||
)).toContain('入队失败');
|
||||
expect(resolveLocalizedErrorMessage(
|
||||
'SHIPPING.STP_NOT_ELIGIBLE',
|
||||
'xfa_shadow_mode',
|
||||
)).toContain('自动建单条件');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user