test(shipping): 更新订单复核库存与通知流程测试

This commit is contained in:
hugo committed 2026-09-04 20:53:06 +08:00
1 parent 8ec028e6a3
commit 265a6e179a
168 files changed
+9420 -4613

No files matched your search

@@ -99,7 +99,9 @@ describe('ReviewCurrentProcessingCard', () => {
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(true);
});
it('renders reload inventory result as the timeout primary action', () => {
it('renders a code-agnostic primary action label from a registered recovery code', () => {
// 卡片是 code-agnostic 渲染器:只要后端下发了受控文案键,就渲染对应业务动作文案。
// 此用例用 reload_inventory_result(仍为写契约有效码)验证卡片对库存动作文案的渲染。
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'inventory_preparation', userStatus: 'retryable', retryable: true,
@@ -309,4 +311,30 @@ describe('ReviewCurrentProcessingCard', () => {
expect(wrapper.get('[data-testid="review-current-task-stage"]').text()).toBe('正在获取最新状态…');
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toBe('待机');
});
it('renders an embedded status detail line when provided', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
userStatus: 'running',
stageCode: 'intake_parse',
statusDetail: { text: '正在等待解析任务启动' },
},
global: { plugins: [i18n] },
});
// 关键断言:说明内嵌于状态行下方(弱文本一行),带 aria-live 与固定 testid;
// 状态行仍为短标签(系统处理中),长句不进入状态位。
const detail = wrapper.get('[data-testid="review-current-task-status-detail"]');
expect(detail.text()).toBe('正在等待解析任务启动');
expect(detail.attributes('aria-live')).toBe('polite');
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toContain('系统处理中');
});
it('renders no status detail line without the prop', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: { userStatus: 'waiting_human', stageCode: 'order_review' },
global: { plugins: [i18n] },
});
// 关键断言:无 statusDetail 时说明行完全不渲染,不留空壳。
expect(wrapper.find('[data-testid="review-current-task-status-detail"]').exists()).toBe(false);
});
});