/** * features/chat/shipping/shippingWorkbenchLayout.spec.ts * 用途:锁定货代会话主区域显隐规则(有会话即全屏批次进度中心,方案 A)。 * 依赖:Vitest、纯函数。 * 逻辑:判定必须同时满足货代智能体与非空会话 ID;普通智能体与新会话一律回落欢迎页。 */ import { describe, expect, it } from 'vitest'; import { shouldShowShippingWorkbench } from './shippingWorkbenchLayout'; describe('shouldShowShippingWorkbench', () => { it('renders the workbench for the shipping agent once a conversation exists', () => { expect(shouldShowShippingWorkbench({ isShippingNoticeAgent: true, conversationId: 'conv-1' })).toBe(true); }); it('keeps the welcome composer before a conversation is created', () => { expect(shouldShowShippingWorkbench({ isShippingNoticeAgent: true, conversationId: '' })).toBe(false); expect(shouldShowShippingWorkbench({ isShippingNoticeAgent: true, conversationId: null })).toBe(false); }); it('never switches other agents to the workbench', () => { expect(shouldShowShippingWorkbench({ isShippingNoticeAgent: false, conversationId: 'conv-1' })).toBe(false); }); });