- 优化聊天附件列表为横向可滚动布局并新增配套测试用例 - 移除自动填充默认用户消息逻辑,空备注时不再伪造默认正文 - 修复流程Gate动作展示逻辑,隐藏历史遗留操作与自动阶段无效按钮 - 完善库存匹配重试与订单快照冻结校验流程 - 优化进度展示优先级,优先显示人工待处理状态 - 移除Excel导出自动推导金额逻辑,强制使用Schema配置字段 - 新增货代通用报表RPA详细设计文档 - 更新相关测试用例与断言逻辑
78 lines
3.1 KiB
TypeScript
78 lines
3.1 KiB
TypeScript
/**
|
|
* features/chat/components/shipping-review/ReviewCurrentProcessingCard.spec.ts
|
|
* 用途:验证工作台右侧当前任务卡只在需要人工处理时渲染业务动作。
|
|
* 依赖:Vitest、Vue Test Utils、Vue I18n、ReviewCurrentProcessingCard。
|
|
* 逻辑:库存自动处理中即使遗留 primary_action,也不得显示编辑正式任务;可重试状态仍保留重试入口。
|
|
*/
|
|
import { mount } from '@vue/test-utils';
|
|
import { createI18n } from 'vue-i18n';
|
|
import { describe, expect, it } from 'vitest';
|
|
import ReviewCurrentProcessingCard from './ReviewCurrentProcessingCard.vue';
|
|
|
|
const i18n = createI18n({
|
|
legacy: false,
|
|
locale: 'zh-CN',
|
|
messages: {
|
|
'zh-CN': {
|
|
'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching': '重新库存匹配',
|
|
},
|
|
},
|
|
});
|
|
|
|
describe('ReviewCurrentProcessingCard', () => {
|
|
it('hides a legacy primary action while inventory preparation is running', () => {
|
|
const wrapper = mount(ReviewCurrentProcessingCard, {
|
|
props: {
|
|
stageCode: 'inventory_preparation',
|
|
userStatus: 'running',
|
|
primaryAction: { code: 'edit_formal_task', i18nKey: 'edit_formal_task' },
|
|
},
|
|
global: { plugins: [i18n] },
|
|
});
|
|
|
|
// 自动处理只显示状态,不能让历史的正式任务编辑动作干扰当前库存阶段。
|
|
expect(wrapper.find('[data-testid="review-current-task-actions"]').exists()).toBe(false);
|
|
});
|
|
|
|
it('keeps the retry action for retryable states', () => {
|
|
const wrapper = mount(ReviewCurrentProcessingCard, {
|
|
props: { stageCode: 'inventory_preparation', userStatus: 'retryable', retryable: true },
|
|
global: { plugins: [i18n] },
|
|
});
|
|
|
|
// 失败后的人工恢复路径不能被运行态过滤误伤。
|
|
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(true);
|
|
});
|
|
|
|
it('renders Gate label_key for every primary action presentation', () => {
|
|
const wrapper = mount(ReviewCurrentProcessingCard, {
|
|
props: {
|
|
stageCode: 'inventory_matching',
|
|
userStatus: 'waiting_human',
|
|
primaryAction: {
|
|
code: 'retry_inventory_matching',
|
|
label_key: 'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching',
|
|
} as any,
|
|
},
|
|
global: { plugins: [i18n] },
|
|
});
|
|
|
|
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').text()).toBe('重新库存匹配');
|
|
});
|
|
|
|
it('renders server-provided recovery actions without duplicating the primary action', async () => {
|
|
const wrapper = mount(ReviewCurrentProcessingCard, {
|
|
props: {
|
|
stageCode: 'inventory_matching',
|
|
userStatus: 'waiting_human',
|
|
primaryAction: { code: 'retry_inventory_matching', i18nKey: 'retry_inventory_matching' },
|
|
recoveryActions: [{ code: 'retry_inventory_from_preparation' }],
|
|
},
|
|
global: { plugins: [i18n] },
|
|
});
|
|
|
|
expect(wrapper.find('[data-testid="review-current-task-recovery-retry_inventory_from_preparation"]').exists()).toBe(true);
|
|
expect(wrapper.findAll('button').length).toBe(2);
|
|
});
|
|
});
|