docs: update references for product families; fix controller import and test isolation

This commit is contained in:
yeuimu
2026-08-28 12:50:42 +08:00
parent c8531bfe08
commit 502b7eba6e
5 changed files with 81 additions and 12 deletions
@@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Query, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { ProductFamiliesService } from './product-families.service';
+8 -6
View File
@@ -48,7 +48,7 @@ describe('SyncService family hooks', () => {
const sdsId = `hook-${stamp}-parse`;
const result1 = await (service as any).upsertOriginGood(
sdsProduct(sdsId, '美国(包邮)240g涤纶休闲短裤-DG206-单面印花-美西洛杉矶一仓'),
'cat-1',
`cat-${stamp}-parse`,
);
expect(result1).toBe('inserted');
const og = await prisma.originGood.findUniqueOrThrow({ where: { sdsGoodId: sdsId } });
@@ -61,7 +61,7 @@ describe('SyncService family hooks', () => {
// 更新为不带仓库的名称 → 解析列全量覆盖(warehouseLabel 置空)
await (service as any).upsertOriginGood(
sdsProduct(sdsId, '美国(不包邮)240g涤纶休闲短裤-DG206-单面印花'),
'cat-1',
`cat-${stamp}-parse`,
);
const og2 = await prisma.originGood.findUniqueOrThrow({ where: { sdsGoodId: sdsId } });
expect(og2.logisticsLabel).toBe('不包邮');
@@ -126,12 +126,14 @@ describe('SyncService family hooks', () => {
});
it('多族命中时不确定归属 → 不挂载', async () => {
const key = `自动挂${stamp}B`;
// 两个族各含一个同分类成员 → 新链接分类命中两个族,归属不明,留给管理员
const sdsCat = `cat-multi-${stamp}`;
const mk = async (suffix: string) => {
const og = await prisma.originGood.create({
data: {
sdsGoodId: `hook-${stamp}-multi-${suffix}`,
goodName: `${key}(包邮)卫衣-ZZB${stamp}-单面印花`,
goodName: `${suffix}(包邮)卫衣-ZZB${stamp}-单面印花`,
sdsCategoryId: sdsCat,
craftLabel: '单面印花',
logisticsLabel: '包邮',
},
@@ -149,8 +151,8 @@ describe('SyncService family hooks', () => {
const sdsId = `hook-${stamp}-multi-new`;
await (service as any).upsertOriginGood(
sdsProduct(sdsId, `${key}(包邮)卫衣-ZZB${stamp}-单面印花-新仓`),
'cat-1',
sdsProduct(sdsId, `(包邮)卫衣-ZZB${stamp}-单面印花-新仓`),
sdsCat,
);
const og = await prisma.originGood.findUniqueOrThrow({ where: { sdsGoodId: sdsId } });
createdOriginGoodIds.push(og.id);