57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
/**
|
|
* 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);
|
|
});
|
|
});
|