feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* features/shipping-progress/progressWindow.spec.ts
|
||||
* 用途:验收密度窗口切分与节点态推导。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { ShippingProcessingProjection } from '@/features/chat/types/shipping.api.types';
|
||||
import {
|
||||
buildProgressWindow,
|
||||
computeProgressWindowRange,
|
||||
resolveStageNodeStatus,
|
||||
stageAbsoluteIndex,
|
||||
} from './progressWindow';
|
||||
|
||||
function baseProjection(
|
||||
overrides: Partial<ShippingProcessingProjection> = {},
|
||||
): ShippingProcessingProjection {
|
||||
return {
|
||||
workItemType: 'order_task',
|
||||
workItemNo: 'OT-1',
|
||||
sourceType: 'eml',
|
||||
rootOrderTaskNo: 'OT-1',
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'c1',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
status: 'blocked',
|
||||
stage: 'inventory_source_resolving',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-05T00:00:00Z',
|
||||
currentGate: null,
|
||||
availableActions: [],
|
||||
sourceSummary: {
|
||||
emailSubject: null,
|
||||
filename: 'a.pdf',
|
||||
documentCount: 1,
|
||||
parsedDocumentCount: 1,
|
||||
candidateCount: 1,
|
||||
customerName: null,
|
||||
poNumber: null,
|
||||
},
|
||||
childOrderTasks: [],
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe('progressWindow', () => {
|
||||
it('anchors inventory_source_resolving at index 7', () => {
|
||||
expect(stageAbsoluteIndex('inventory_source_resolving')).toBe(7);
|
||||
});
|
||||
|
||||
it('workbench shows all 15 stages', () => {
|
||||
const nodes = buildProgressWindow(baseProjection({ sourceType: 'eml' }), 'workbench');
|
||||
expect(nodes).toHaveLength(15);
|
||||
expect(nodes[7]?.isCurrent).toBe(true);
|
||||
expect(nodes[7]?.status).toBe('blocked');
|
||||
});
|
||||
|
||||
it('chat window stays within 3–5 visible nodes', () => {
|
||||
const nodes = buildProgressWindow(baseProjection(), 'chat');
|
||||
expect(nodes.length).toBeGreaterThanOrEqual(3);
|
||||
expect(nodes.length).toBeLessThanOrEqual(5);
|
||||
expect(nodes.some((n) => n.isCurrent)).toBe(true);
|
||||
});
|
||||
|
||||
it('marks EML-only stages skipped for direct_pdf', () => {
|
||||
const status = resolveStageNodeStatus({
|
||||
absoluteIndex: 1,
|
||||
currentIndex: 7,
|
||||
projectionStatus: 'processing',
|
||||
sourceType: 'direct_pdf',
|
||||
stage: 'email_parsing',
|
||||
});
|
||||
expect(status).toBe('skipped');
|
||||
});
|
||||
|
||||
it('centers window around current index', () => {
|
||||
const { start, end } = computeProgressWindowRange(7, 'right', 15);
|
||||
expect(end - start).toBe(6);
|
||||
expect(start).toBeLessThanOrEqual(7);
|
||||
expect(end).toBeGreaterThan(7);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user