清理废弃的shipping xfa ocr automark相关代码和job配置 新增收料报表管理的前端页面、路由和侧边栏入口 新增后端收料报表配置接口、数据库模型和RPA脚本 优化发货通知流程的重试策略,将shipping相关job默认不自动重试 移除废弃的库存源确认相关逻辑,更新流程门禁规则 重构订单模板的值适配器模块,新增坐标OCR值适配器 清理前端shipping菜单和action的废弃选项 更新相关文档和测试用例,调整.gitignore忽略规则
73 lines
3.3 KiB
TypeScript
73 lines
3.3 KiB
TypeScript
/**
|
||
* features/chat/components/shipping-review/ReviewProfileMatchPanel.spec.ts
|
||
* 用途:锁定模板匹配侧栏的候选披露规则,避免候选数量增长撑长工作台。
|
||
* 依赖:vitest、@vue/test-utils、vue-i18n、ReviewProfileMatchPanel。
|
||
* 逻辑:所有状态默认收起;用户可手动展开/收起候选列表。
|
||
*/
|
||
import { describe, expect, it } from 'vitest';
|
||
import { mount } from '@vue/test-utils';
|
||
import { createI18n } from 'vue-i18n';
|
||
import ReviewProfileMatchPanel from './ReviewProfileMatchPanel.vue';
|
||
|
||
const i18n = createI18n({
|
||
legacy: false,
|
||
locale: 'zh-CN',
|
||
messages: {
|
||
'zh-CN': {
|
||
chat: { shippingOrderReview: { profileMatch: {
|
||
title: '文档模板匹配', subtitle: '摘要', selected: '命中模板', noSelected: '未选定模板',
|
||
expandCandidates: '查看候选模板({count})', collapseCandidates: '收起候选模板',
|
||
routeType: '路由类型', executionMode: '执行模式',
|
||
status: { matched: '已匹配', ambiguous: '多个候选' },
|
||
} } },
|
||
},
|
||
},
|
||
});
|
||
|
||
function mountPanel(needsReview = false) {
|
||
return mount(ReviewProfileMatchPanel, {
|
||
props: {
|
||
profileMatch: {
|
||
available: true,
|
||
visibility: 'admin',
|
||
status: needsReview ? 'ambiguous' : 'matched',
|
||
needs_review: needsReview,
|
||
selected_profile: { profile_code: 'ODP-A', display_name: '客户订单模板', version: 1 },
|
||
candidates: [
|
||
{ profile_code: 'ODP-A', display_name: '客户订单模板', score: 0.99 },
|
||
{ profile_code: 'ODP-B', display_name: '客户订单模板(旧版)', score: 0.98 },
|
||
],
|
||
fallback_reason_codes: [],
|
||
},
|
||
},
|
||
global: { plugins: [i18n] },
|
||
});
|
||
}
|
||
|
||
describe('ReviewProfileMatchPanel', () => {
|
||
it('默认收起无需关注的候选列表', () => {
|
||
const wrapper = mountPanel(false);
|
||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||
expect(wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').text()).toContain('查看候选模板(2)');
|
||
});
|
||
|
||
it('多个候选且需要人工处理时也默认收起,并允许展开后收起', async () => {
|
||
const wrapper = mountPanel(true);
|
||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(true);
|
||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||
});
|
||
|
||
it('候选模板优先展示模板名称,不把内部编号作为主文案', async () => {
|
||
const wrapper = mountPanel(true);
|
||
|
||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||
|
||
// 关键断言:业务用户辨认模板依赖 display_name,ODP 编号不应出现在候选列表主展示中。
|
||
expect(wrapper.get('[data-testid="review-profile-match-candidates"]').text()).toContain('客户订单模板');
|
||
expect(wrapper.get('[data-testid="review-profile-match-candidates"]').text()).not.toContain('ODP-A');
|
||
});
|
||
});
|