来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
94 lines
4.5 KiB
TypeScript
94 lines
4.5 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
||
import path from 'path';
|
||
import { describe, expect, it } from 'vitest';
|
||
|
||
describe('称上识别轻量候选名单', () => {
|
||
const weighSrc = readFileSync(
|
||
path.join(__dirname, '../src/services/weighStationService.ts'),
|
||
'utf8'
|
||
);
|
||
const processingSrc = readFileSync(
|
||
path.join(__dirname, '../src/services/processingTaskService.ts'),
|
||
'utf8'
|
||
);
|
||
const routesSrc = readFileSync(
|
||
path.join(__dirname, '../src/routes/mobile/mobileWarehouseRoutes.ts'),
|
||
'utf8'
|
||
);
|
||
|
||
it('验收识别走 catalog,不走重列表 attach/received_qty', () => {
|
||
expect(weighSrc).toContain('listPendingInspectionWeighStationCatalog');
|
||
const recognizeBody = weighSrc.slice(
|
||
weighSrc.indexOf('export async function recognizeInspectionWeighStation'),
|
||
weighSrc.indexOf('export async function recognizeProcessingInspectWeighStation')
|
||
);
|
||
expect(recognizeBody).toContain('listPendingInspectionWeighStationCatalog');
|
||
expect(recognizeBody).not.toContain('listPendingInspectionWeighStationItems');
|
||
expect(recognizeBody).not.toContain('attachCategoryPhotoInspectionRequirements');
|
||
expect(recognizeBody).not.toContain('received_qty');
|
||
|
||
const catalogBody = weighSrc.slice(
|
||
weighSrc.indexOf('export async function listPendingInspectionWeighStationCatalog'),
|
||
weighSrc.indexOf('export async function recognizeInspectionWeighStation')
|
||
);
|
||
expect(catalogBody).not.toContain('received_qty');
|
||
expect(catalogBody).not.toContain('attachCategoryPhotoInspectionRequirements');
|
||
expect(catalogBody).not.toContain('LIMIT 200');
|
||
});
|
||
|
||
it('分拣识别走 catalog,不拉 enriched 全量', () => {
|
||
const recognizeBody = weighSrc.slice(
|
||
weighSrc.indexOf('export async function recognizeWeighStation'),
|
||
weighSrc.indexOf('function inspectionPendingBranchClause')
|
||
);
|
||
expect(recognizeBody).toContain('listPendingWeighStationCatalog');
|
||
expect(recognizeBody).not.toContain('listPendingWeighStationItems');
|
||
expect(weighSrc).toContain('listPendingWeighStationCatalog');
|
||
});
|
||
|
||
it('加工验收识别走轻量 catalog', () => {
|
||
expect(processingSrc).toContain('listProcessingInspectCatalogForRecognize');
|
||
const recognizeBody = weighSrc.slice(
|
||
weighSrc.indexOf('export async function recognizeProcessingInspectWeighStation'),
|
||
weighSrc.indexOf('export async function commitWeighStation')
|
||
);
|
||
expect(recognizeBody).toContain('listProcessingInspectCatalogForRecognize');
|
||
expect(recognizeBody).not.toContain('listProcessingTasks');
|
||
});
|
||
|
||
it('AI_CATALOG_MAX 仍导出;开放认品对全量 catalog 匹配、不截断再喂模型', () => {
|
||
expect(weighSrc).toContain('export const AI_CATALOG_MAX = 80');
|
||
const recognizeBody = weighSrc.slice(
|
||
weighSrc.indexOf('export async function recognizeAgainstCatalog'),
|
||
weighSrc.indexOf('export async function recognizeWeighStation')
|
||
);
|
||
expect(recognizeBody).toContain('recognizeProductFromImage');
|
||
expect(recognizeBody).toContain('catalog,');
|
||
expect(recognizeBody).not.toContain('catalogForAi.slice(0, AI_CATALOG_MAX)');
|
||
expect(recognizeBody).toContain('toCandidateRows(items');
|
||
});
|
||
|
||
it('待验/待拣 meta、search、product 函数存在', () => {
|
||
expect(weighSrc).toContain('export async function getPendingInspectionWeighStationMeta');
|
||
expect(weighSrc).toContain('export async function searchPendingInspectionWeighStation');
|
||
expect(weighSrc).toContain('export async function listPendingInspectionWeighStationByProduct');
|
||
expect(weighSrc).toContain('export async function getPendingWeighStationMeta');
|
||
expect(weighSrc).toContain('export async function searchPendingWeighStation');
|
||
expect(weighSrc).toContain('export async function listPendingWeighStationByProduct');
|
||
});
|
||
|
||
it('pending 路由默认 meta,search/product 已挂载', () => {
|
||
expect(routesSrc).toContain("/inspection/weigh-station/pending");
|
||
expect(routesSrc).toContain("/inspection/weigh-station/search");
|
||
expect(routesSrc).toContain("/inspection/weigh-station/product");
|
||
expect(routesSrc).toContain("/picking/weigh-station/pending");
|
||
expect(routesSrc).toContain("/picking/weigh-station/search");
|
||
expect(routesSrc).toContain("/picking/weigh-station/product");
|
||
expect(routesSrc).toContain("getPendingInspectionWeighStationMeta");
|
||
expect(routesSrc).toContain("getPendingWeighStationMeta");
|
||
expect(routesSrc).toContain("mode");
|
||
expect(routesSrc).toContain('meta');
|
||
expect(routesSrc).toContain("!== 'full'");
|
||
});
|
||
});
|