/** * features/shipping-progress/components/presenters.spec.ts * 用途:四页面进度 Presenter 冒烟挂载。 */ import { describe, expect, it } from 'vitest'; import { mount } from '@vue/test-utils'; import { createI18n } from 'vue-i18n'; import type { ShippingProcessingProjection } from '@/features/chat/types/shipping.api.types'; import ChatProgressSummary from './ChatProgressSummary.vue'; import SidebarProgressInline from './SidebarProgressInline.vue'; import ReviewProgressStrip from './ReviewProgressStrip.vue'; import ReviewProcessDetailDrawer from './ReviewProcessDetailDrawer.vue'; import WorkbenchProgressGrouped from './WorkbenchProgressGrouped.vue'; function sampleProjection(): 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: 'waiting_review', progressVersion: 1, lastActivityAt: '2026-08-05T00:00:00Z', currentGate: { gateCode: 'order_review', status: 'blocked', nextActionCode: 'open_order_review', blockingReasonCode: 'review_required', attemptNo: 1, }, availableActions: ['open_order_review', 'refresh'], sourceSummary: { emailSubject: null, filename: 'a.pdf', documentCount: 1, parsedDocumentCount: 1, candidateCount: 1, customerName: null, poNumber: null, }, childOrderTasks: [], }; } const i18n = createI18n({ legacy: false, locale: 'zh-CN', messages: { 'zh-CN': { chat: { shippingProcessing: { stage: { waiting_review: '订单复核' }, status: { blocked: '已阻断' }, progress: { completedOfTotal: '已完成 {done} / {total}', currentStage: '当前:{stage}', remainingHint: '后续还有 {count} 个阶段', positionOfTotal: '第 {current} / {total}', domainIntake: '解析与复核', domainInventory: '库存', domainFulfillment: '履约与上传', domainReceiveParse: '接收与解析', domainCandidateIdentity: '候选识别', domainOrderConfirm: '订单确认', domainInventoryHandle: '库存处理', domainFulfillmentShip: '发货履约', currentNeedLabel: '当前需要:', systemProcessingNeed: '系统处理中', viewProcessDetails: '查看流程详情', closeProcessDetails: '关闭', processDetailsTitle: '流程详情', nodeTime: '时间', nodeActor: '主体', placeholderDash: '—', viewFullAudit: '审计', }, stageNode: { skipped: '已跳过', pending: '未开始', running: '进行中', passed: '已通过', blocked: '已阻断', failed: '失败', }, gateReasons: { generic: '需要人工', review_required: '需要复核', }, action: { open_order_review: '进入复核', open_order_processing: '进入订单处理', refresh: '刷新进度', more: '更多', }, expandHistory: '展开', collapseHistory: '收起', panelTitle: '当前货代处理', }, }, workspace: { shippingNotice: { workflowReasons: { review_required: '需要复核' }, }, }, }, }, }); describe('shipping progress presenters', () => { const projection = sampleProjection(); it('mounts ChatProgressSummary', () => { const wrapper = mount(ChatProgressSummary, { props: { projection }, global: { plugins: [i18n] }, }); expect(wrapper.find('[data-testid="chat-progress-summary"]').exists()).toBe(true); }); it('mounts SidebarProgressInline', () => { const wrapper = mount(SidebarProgressInline, { props: { projection }, global: { plugins: [i18n] }, }); expect(wrapper.find('[data-testid="sidebar-progress-inline"]').exists()).toBe(true); }); it('mounts ReviewProgressStrip as compact five-domain readonly strip', () => { const wrapper = mount(ReviewProgressStrip, { props: { projection }, global: { plugins: [i18n] }, }); expect(wrapper.find('[data-testid="review-progress-strip"]').exists()).toBe(true); expect(wrapper.findAll('[data-testid="review-progress-domains"] [data-domain]').length).toBe(5); // 正文不得再挂 ActionBar / 页内完整 15 阶展开 expect(wrapper.find('[data-testid="unified-action-bar"]').exists()).toBe(false); expect(wrapper.find('[data-testid="review-progress-expand-full"]').exists()).toBe(false); expect(wrapper.find('[data-testid="review-progress-nodes-strip"]').exists()).toBe(false); expect(wrapper.find('[data-testid="review-progress-open-details"]').exists()).toBe(true); }); it('mounts ReviewProcessDetailDrawer with readonly 15 nodes', () => { const wrapper = mount(ReviewProcessDetailDrawer, { props: { open: true, projection, poNumber: 'PO-1', orderTaskNo: 'OT-1', }, global: { plugins: [i18n], stubs: { Teleport: { template: '