chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑

This commit is contained in:
hugo committed 2026-08-17 19:56:51 +08:00
1 parent 5ef8329bd8
commit 4ec4e57005
183 files changed
+14653 -3936

No files matched your search

@@ -77,7 +77,13 @@ function detail(): ShippingTaskDetail {
task_no: 'SN-1',
ui_state: {
summary: { title: 't', message: 'm' },
action_buttons: [],
actions: {
primary: {
code: 'retry_inventory_matching', kind: 'recovery', enabled: true,
requires_confirmation: false,
},
secondary: [],
},
checkpoint_kind: 'inventory',
process_gate: {
execution_no: 'SPE-1',
@@ -107,7 +113,7 @@ describe('TaskTodoPanel actionsExecutable', () => {
global: { plugins: [i18n] },
});
expect(wrapper.get('[data-testid="gate-stub"]').attributes('data-can-handle')).toBe('false');
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('retry_inventory_matching');
await flushPromises();
expect(postGateAction).toHaveBeenCalledWith(
'SPE-1',
@@ -131,7 +137,7 @@ describe('TaskTodoPanel actionsExecutable', () => {
},
global: { plugins: [i18n] },
});
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('retry_inventory_matching');
await flushPromises();
expect(postGateAction).not.toHaveBeenCalled();
});
@@ -146,7 +152,7 @@ describe('TaskTodoPanel actionsExecutable', () => {
},
global: { plugins: [i18n] },
});
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('retry_inventory_matching');
await flushPromises();
expect(postGateAction).not.toHaveBeenCalled();
});
@@ -185,4 +191,24 @@ describe('TaskTodoPanel actionsExecutable', () => {
// 自动推进阶段只允许 Gate 的刷新进度入口,不能泄漏正式任务编辑。
expect(wrapper.text()).not.toContain('编辑正式任务');
});
it('hides an action that has no user-facing label instead of exposing its code', () => {
const task = detail();
task.ui_state = {
...task.ui_state,
actions: {
primary: { code: 'internal_only_action', kind: 'recovery', enabled: true },
secondary: [],
},
process_gate: undefined,
} as ShippingTaskDetail['ui_state'];
const wrapper = mount(TaskTodoPanel, {
props: { detail: task, actionsExecutable: true },
global: { plugins: [i18n] },
});
// 用户面没有受控文案的动作必须 fail-closed,不能再次暴露内部 action code。
expect(wrapper.text()).not.toContain('internal_only_action');
});
});