feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -2,7 +2,7 @@
|
||||
* features/chat/shipping/useChatShippingDecision.spec.ts
|
||||
* 用途:验证发货通知决策处理器经 Chat Turn 发起,silent 模式不追加用户气泡。
|
||||
* 依赖:vitest、vue refs、useChatShippingDecision。
|
||||
* 逻辑:mock startChatTurn,覆盖 silent/普通决策、显式 taskId 与 inventory_mapping 分支。
|
||||
* 逻辑:mock startChatTurn,覆盖 silent/普通决策与显式 taskId 分支。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
@@ -26,11 +26,9 @@ const createContext = (
|
||||
history: ref([{ conversation_id: 'conv-001' }]),
|
||||
isShippingNoticeAgent: computed(() => true),
|
||||
currentAgentId: computed(() => 42),
|
||||
shippingInventorySchemaPreviewCache: ref({}),
|
||||
getActiveShippingTaskId: () => 'SN-FOCUS-001',
|
||||
getActiveShippingBatchNo: () => 'BATCH-001',
|
||||
loadHistory: vi.fn(async () => undefined),
|
||||
openShippingInventoryMappingFormForTask: vi.fn(async () => true),
|
||||
refreshShippingActions: vi.fn(async () => undefined),
|
||||
startChatTurn: defaultStartChatTurn,
|
||||
msg: {
|
||||
@@ -115,21 +113,6 @@ describe('useChatShippingDecision', () => {
|
||||
expect(ctx.msg.warning).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('submits confirm_inventory_mapping via submit_decision Chat Turn', async () => {
|
||||
const ctx = createContext();
|
||||
const { executeShippingDecision } = createShippingDecisionHandlers(ctx);
|
||||
|
||||
const ok = await executeShippingDecision('confirm_inventory_mapping', '确认');
|
||||
|
||||
expect(ok).toBe(true);
|
||||
expect(ctx.startChatTurn).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
actionType: 'shipping.submit_decision',
|
||||
payload: { task_no: 'SN-FOCUS-001', decision: 'confirm_inventory_mapping' },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('returns false when startChatTurn reports failure', async () => {
|
||||
const ctx = createContext({
|
||||
startChatTurn: vi.fn(async () => false),
|
||||
|
||||
Reference in new issue
Block a user