43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/**
|
|
* features/chat/shipping/shippingSubmissionFeedback.spec.ts
|
|
* 用途:验收统一提交决策反馈结构(无弹窗、含短时标签码)。
|
|
* 依赖:Vitest、shippingSubmissionFeedback。
|
|
*/
|
|
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
buildShippingSubmissionFeedback,
|
|
createComposerContextId,
|
|
createShippingSubmissionId,
|
|
} from './shippingSubmissionFeedback';
|
|
|
|
describe('shippingSubmissionFeedback', () => {
|
|
it('maps appended / created decisions to badge codes', () => {
|
|
expect(buildShippingSubmissionFeedback({
|
|
decision: 'appended',
|
|
user_task_no: 'OT-1',
|
|
run_no: 'RUN-1',
|
|
created_new: false,
|
|
}, 3)).toMatchObject({
|
|
decision: 'appended',
|
|
badgeCode: 'just_appended',
|
|
fileCount: 3,
|
|
recentAppendCount: 3,
|
|
});
|
|
expect(buildShippingSubmissionFeedback({
|
|
decision: 'created',
|
|
user_task_no: 'OT-2',
|
|
run_no: 'RUN-2',
|
|
created_new: true,
|
|
}, 1)).toMatchObject({
|
|
decision: 'created',
|
|
badgeCode: 'just_created',
|
|
createdNew: true,
|
|
});
|
|
});
|
|
|
|
it('creates stable-looking submission and composer ids', () => {
|
|
expect(createShippingSubmissionId()).toMatch(/^SUB-/);
|
|
expect(createComposerContextId()).toMatch(/^CMP-/);
|
|
});
|
|
});
|