feat(shipping-notice): 新增发货通知重复检测与处理接口,支持重复决策保存与重新执行检测

This commit is contained in:
hugo committed 2026-07-14 21:12:36 +08:00
1 parent 729546a7b7
commit ceb49461e8
72 files changed
+14270 -460

No files matched your search

@@ -0,0 +1,56 @@
/**
* features/chat/shipping/shippingNoticeAttachmentIntegrity.spec.ts
* 用途:附件完整性门禁单测;阻断码与截断路径须能阻止建单判定。
*/
import { describe, expect, it } from 'vitest';
import {
BLOCKING_WARNING_PREFIXES,
isShippingNoticeAttachmentParseIncomplete,
} from './shippingNoticeAttachmentIntegrity';
describe('shippingNoticeAttachmentIntegrity', () => {
it('treats each blocking warning prefix as incomplete', () => {
for (const prefix of BLOCKING_WARNING_PREFIXES) {
expect(
isShippingNoticeAttachmentParseIncomplete({
warnings: [`${prefix}demo`],
attachments: [],
}),
).toBe(true);
}
});
it('treats per-attachment text truncation as incomplete', () => {
expect(
isShippingNoticeAttachmentParseIncomplete({
attachment_count: 1,
attachments: [
{
parse_status: 'parsed',
warnings: ['eml_attachment_text_truncated:10'],
},
],
warnings: [],
}),
).toBe(true);
});
it('treats notice_text_truncated as incomplete', () => {
expect(
isShippingNoticeAttachmentParseIncomplete({
warnings: ['notice_text_truncated:200000'],
attachments: [],
}),
).toBe(true);
});
it('allows clean parsed summary', () => {
expect(
isShippingNoticeAttachmentParseIncomplete({
attachment_count: 1,
attachments: [{ parse_status: 'parsed', warnings: [] }],
warnings: [],
}),
).toBe(false);
});
});