只读展示分拣出库时逐商品行拍的照片(picking_items.outbound_photos),与「配送补拍」独立、不排除加菜行。后端 listPickingOutboundPhotoReviews + Web 路由/MCP 分流 + Tab 计数增至四项;前端第 4 个 Tab、列与 Copilot 动作;三语 6 键。无迁移、无写路径。
81 lines
3.3 KiB
TypeScript
81 lines
3.3 KiB
TypeScript
import { readFileSync } from 'fs';
|
||
import { describe, expect, it } from 'vitest';
|
||
|
||
const reviewSrc = readFileSync(
|
||
new URL('../src/services/inspectionReviewService.ts', import.meta.url),
|
||
'utf8'
|
||
);
|
||
const reviewOps = readFileSync(
|
||
new URL('../src/services/inspectionReviewOps.ts', import.meta.url),
|
||
'utf8'
|
||
);
|
||
const reviewRoute = readFileSync(
|
||
new URL('../src/modules/workflow/routes/inspectionRoutes.ts', import.meta.url),
|
||
'utf8'
|
||
);
|
||
const mcpTool = readFileSync(new URL('../src/mcp/tools/inspectionReview.ts', import.meta.url), 'utf8');
|
||
const page = readFileSync(
|
||
new URL('../../src/pages/inspection/InspectionReviewManagement.tsx', import.meta.url),
|
||
'utf8'
|
||
);
|
||
const contract = readFileSync(
|
||
new URL('../../src/pages/inspection/copilotInspectionReviewPageContract.ts', import.meta.url),
|
||
'utf8'
|
||
);
|
||
const api = readFileSync(new URL('../../src/utils/workflowApi.ts', import.meta.url), 'utf8');
|
||
const zh = readFileSync(new URL('../../src/i18n/locales/zh-CN/inspection.ts', import.meta.url), 'utf8');
|
||
const en = readFileSync(new URL('../../src/i18n/locales/en/inspection.ts', import.meta.url), 'utf8');
|
||
const id = readFileSync(new URL('../../src/i18n/locales/id/inspection.ts', import.meta.url), 'utf8');
|
||
|
||
describe('出库照片复核 Tab(picking_items.outbound_photos)', () => {
|
||
it('服务读 picking_items.outbound_photos 并标 picking_outbound(与配送补拍口径独立)', () => {
|
||
expect(reviewSrc).toContain('export async function listPickingOutboundPhotoReviews');
|
||
expect(reviewSrc).toContain('pi.outbound_photos');
|
||
expect(reviewSrc).toContain("'picking_outbound'::text AS source_type");
|
||
expect(reviewOps).toContain('listPickingOutboundPhotoReviews');
|
||
});
|
||
|
||
it('Tab 计数含 picking_outbound(四项)', () => {
|
||
expect(reviewSrc).toContain('delivery_sign, picking_outbound] = await Promise.all([');
|
||
expect(reviewSrc).toContain(
|
||
'return { inspections, loading_photos, delivery_sign, picking_outbound }'
|
||
);
|
||
});
|
||
|
||
it('Web 路由与 MCP 按 source=picking_outbound 分流', () => {
|
||
expect(reviewRoute).toContain("source === 'picking_outbound'");
|
||
expect(reviewRoute).toContain('listPickingOutboundPhotoReviews');
|
||
expect(mcpTool).toContain("statusRaw === 'picking_outbound'");
|
||
expect(mcpTool).toContain('listPickingOutboundPhotoReviews');
|
||
});
|
||
|
||
it('前端接入第 4 个 Tab、列与 Copilot 动作', () => {
|
||
expect(page).toContain('PICKING_OUTBOUND_COLUMNS');
|
||
expect(page).toContain("t('inspection.review.tab.pickingOutbound')");
|
||
expect(page).toContain("t('inspection.review.empty.pickingOutbound')");
|
||
expect(page).toContain("actionId === 'show_picking_outbound'");
|
||
expect(contract).toContain("'picking_outbound'");
|
||
expect(contract).toContain('show_picking_outbound');
|
||
expect(api).toContain('picking_outbound');
|
||
});
|
||
|
||
it('三语均含 6 个新键(i18n 键一致)', () => {
|
||
for (const [name, src] of [
|
||
['zh-CN', zh],
|
||
['en', en],
|
||
['id', id],
|
||
] as const) {
|
||
for (const key of [
|
||
'review.tab.pickingOutbound',
|
||
'review.aria.pickingOutbound',
|
||
'review.col.pickingTime',
|
||
'review.source.pickingOutbound',
|
||
'review.list.pickingOutbound',
|
||
'review.empty.pickingOutbound',
|
||
]) {
|
||
expect(src, `${name} 缺 ${key}`).toContain(`'${key}'`);
|
||
}
|
||
}
|
||
});
|
||
});
|