feat(goods): add editable custom products
This commit is contained in:
@@ -306,6 +306,36 @@ describe('PublicService', () => {
|
||||
expect(result.items[0].goodId).not.toBe(goodIds[0].toString());
|
||||
});
|
||||
|
||||
it('returns custom goods through the same public product contract', async () => {
|
||||
const customPublicId = `custom-public-${stamp}`;
|
||||
const origin = await prisma.originGood.create({
|
||||
data: {
|
||||
source: 'CUSTOM',
|
||||
sdsGoodId: customPublicId,
|
||||
goodName: `Pub Custom ${stamp}`,
|
||||
goodPrice: 42,
|
||||
detail: { create: { productCode: `CUSTOM-${stamp}` } },
|
||||
},
|
||||
});
|
||||
const good = await prisma.good.create({
|
||||
data: {
|
||||
originGoodId: origin.id,
|
||||
countryId,
|
||||
categoryId,
|
||||
goodName: `Pub Custom ${stamp}`,
|
||||
},
|
||||
});
|
||||
try {
|
||||
const detail = await service.getGood(customPublicId);
|
||||
expect(detail.goodId).toBe(customPublicId);
|
||||
expect(detail.goodName).toBe(`Pub Custom ${stamp}`);
|
||||
expect(detail.productCode).toBe(`CUSTOM-${stamp}`);
|
||||
} finally {
|
||||
await prisma.good.delete({ where: { id: good.id } });
|
||||
await prisma.originGood.delete({ where: { id: origin.id } });
|
||||
}
|
||||
});
|
||||
|
||||
it('getGood returns detail and 404 for unknown id', async () => {
|
||||
const first = await service.getGoods({
|
||||
page: 1,
|
||||
|
||||
Reference in New Issue
Block a user