清理废弃的shipping xfa ocr automark相关代码和job配置 新增收料报表管理的前端页面、路由和侧边栏入口 新增后端收料报表配置接口、数据库模型和RPA脚本 优化发货通知流程的重试策略,将shipping相关job默认不自动重试 移除废弃的库存源确认相关逻辑,更新流程门禁规则 重构订单模板的值适配器模块,新增坐标OCR值适配器 清理前端shipping菜单和action的废弃选项 更新相关文档和测试用例,调整.gitignore忽略规则
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
/**
|
|
* features/chat/shipping/useChatShippingDecision.spec.ts
|
|
* 用途:验证发货 Chat 不再承载履约写,操作只刷新权威 OT 投影。
|
|
* 依赖:vitest、vue refs、useChatShippingDecision。
|
|
* 逻辑:mock startChatTurn,覆盖 silent/普通决策与显式 taskId 分支。
|
|
*/
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { createShippingDecisionHandlers, type ShippingDecisionContext } from './useChatShippingDecision';
|
|
|
|
const createContext = (
|
|
overrides: Partial<ShippingDecisionContext> = {},
|
|
): ShippingDecisionContext => ({
|
|
getActiveShippingTaskId: () => 'SN-FOCUS-001',
|
|
refreshShippingActions: vi.fn(async () => undefined),
|
|
msg: {
|
|
warning: vi.fn(),
|
|
},
|
|
t: (key: string) => key,
|
|
...overrides,
|
|
});
|
|
|
|
describe('useChatShippingDecision', () => {
|
|
|
|
it('does not dispatch a Chat Turn for a legacy decision', async () => {
|
|
const ctx = createContext();
|
|
const { executeShippingDecision } = createShippingDecisionHandlers(ctx);
|
|
|
|
const ok = await executeShippingDecision('reparse_inventory', '重新上传库存', { silent: true });
|
|
|
|
expect(ok).toBe(false);
|
|
expect(ctx.refreshShippingActions).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
it('does not dispatch a Chat Turn for a normal legacy decision', async () => {
|
|
const ctx = createContext();
|
|
const { executeShippingDecision } = createShippingDecisionHandlers(ctx);
|
|
|
|
const ok = await executeShippingDecision('confirm', '确认');
|
|
|
|
expect(ok).toBe(false);
|
|
expect(ctx.refreshShippingActions).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
it('refreshes authoritative actions when Chat decision is rejected', async () => {
|
|
const ctx = createContext();
|
|
const { executeShippingDecision } = createShippingDecisionHandlers(ctx);
|
|
|
|
const ok = await executeShippingDecision('retry_rpa', '重新获取库存');
|
|
|
|
expect(ok).toBe(false);
|
|
expect(ctx.refreshShippingActions).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
it('does not dispatch even when a legacy decision supplies an explicit taskId', async () => {
|
|
const ctx = createContext({
|
|
getActiveShippingTaskId: () => '',
|
|
});
|
|
const { executeShippingDecision } = createShippingDecisionHandlers(ctx);
|
|
|
|
const ok = await executeShippingDecision('retry_rpa', '重新获取库存', { taskId: 'sn-target-009' });
|
|
|
|
expect(ok).toBe(false);
|
|
});
|
|
|
|
it('does not dispatch manual upload through Chat', async () => {
|
|
const ctx = createContext();
|
|
const { executeShippingManualUpload } = createShippingDecisionHandlers(ctx);
|
|
|
|
const ok = await executeShippingManualUpload('SN-FOCUS-001');
|
|
|
|
expect(ok).toBe(false);
|
|
});
|
|
});
|