test(public): cover home-goods family dedupe

This commit is contained in:
yeuimu
2026-08-28 18:44:24 +08:00
parent 8a052773cd
commit 63b436fe41
@@ -387,6 +387,14 @@ describe('PublicService', () => {
);
});
it('home-goods dedupes by family (keeps the best-positioned good)', async () => {
const home = await service.getHomeGoods({ limit: 50 });
// fixture 族的两条带位商品(High index=1 / Mid index=5)→ 只出一条代表行
const ours = home.filter((h) => h.goodId === familyId.toString());
expect(ours).toHaveLength(1);
expect(ours[0].goodName).toBe(`Pub High ${stamp}`);
});
it('getTags returns tags with their group info, sorted by group then order', async () => {
const tags = await service.getTags();
expect(tags.length).toBeGreaterThan(0);