chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑
This commit is contained in:
1 parent
5ef8329bd8
commit
4ec4e57005
183 files changed
+14653
-3936
No files matched your search
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
resolveShippingProcessingReasonLabel,
|
||||
resolveShippingProcessingMessage,
|
||||
resolveShippingProcessingStageLabel,
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingStatusKey,
|
||||
} from './shippingProcessingLabels';
|
||||
@@ -36,6 +38,33 @@ describe('shippingProcessingLabels', () => {
|
||||
expect(resolveShippingProcessingStatusLabel('pending_review', te, t)).toBe('待复核');
|
||||
});
|
||||
|
||||
it('uses the safe unknown label instead of exposing an unrecognized status code', () => {
|
||||
const te = (key: string) => key === 'chat.shippingProcessing.taskStatus.unknown';
|
||||
const t = (key: string) => key.endsWith('.unknown') ? '状态待确认' : key;
|
||||
expect(resolveShippingProcessingStatusLabel('internal_processing_state', te, t)).toBe('状态待确认');
|
||||
});
|
||||
|
||||
it('uses the reason i18n key regardless of snake or camel case', () => {
|
||||
const te = (key: string) => key === 'chat.shippingProcessing.reasonCode.generic_extraction_disabled';
|
||||
const t = () => '当前文件不满足自动解析条件,需要人工复核';
|
||||
expect(resolveShippingProcessingReasonLabel({
|
||||
code: 'generic_extraction_disabled',
|
||||
i18n_key: 'chat.shippingProcessing.reasonCode.generic_extraction_disabled',
|
||||
}, te, t)).toBe('当前文件不满足自动解析条件,需要人工复核');
|
||||
});
|
||||
|
||||
it('uses a safe reason label instead of exposing an unknown internal reason code', () => {
|
||||
const te = (key: string) => key === 'chat.shippingProcessing.reasonCode.unknown';
|
||||
const t = (key: string) => key.endsWith('.unknown') ? '当前步骤需要人工处理' : key;
|
||||
expect(resolveShippingProcessingReasonLabel({ code: 'internal_gate_reason' }, te, t)).toBe('当前步骤需要人工处理');
|
||||
});
|
||||
|
||||
it('uses a safe stage label instead of exposing an unknown internal stage code', () => {
|
||||
const te = (key: string) => key === 'chat.shippingProcessing.stageLabel.waiting_system_start';
|
||||
const t = (key: string) => key.endsWith('waiting_system_start') ? '等待系统启动' : key;
|
||||
expect(resolveShippingProcessingStageLabel('internal_gate_stage', te, t)).toBe('等待系统启动');
|
||||
});
|
||||
|
||||
it('resolves group messages from shippingProcessing', () => {
|
||||
const te = (key: string) => key === 'chat.shippingProcessing.groupNeedsAction';
|
||||
const t = (key: string, params?: Record<string, unknown>) => (
|
||||
|
||||
Reference in new issue
Block a user