refactor(api): group public tag filters
This commit is contained in:
@@ -247,9 +247,12 @@ describe('PublicService', () => {
|
||||
pageSize: 50,
|
||||
countryId: countryId.toString(),
|
||||
keyword: `Pub `,
|
||||
tagIds: filterTagIds
|
||||
.slice(0, 2)
|
||||
.map((tagId) => `${filterGroupIds[0]}:${tagId}`),
|
||||
tags: [
|
||||
{
|
||||
tagGroupId: filterGroupIds[0].toString(),
|
||||
tagIds: filterTagIds.slice(0, 2).map(String),
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(sameGroup.items.map((item) => item.goodName)).toEqual(
|
||||
expect.arrayContaining([`Pub High ${stamp}`, `Pub Mid ${stamp}`]),
|
||||
@@ -260,10 +263,16 @@ describe('PublicService', () => {
|
||||
pageSize: 50,
|
||||
countryId: countryId.toString(),
|
||||
keyword: `Pub `,
|
||||
tagIds: filterTagIds.map(
|
||||
(tagId, index) =>
|
||||
`${index < 2 ? filterGroupIds[0] : filterGroupIds[1]}:${tagId}`,
|
||||
),
|
||||
tags: [
|
||||
{
|
||||
tagGroupId: filterGroupIds[0].toString(),
|
||||
tagIds: filterTagIds.slice(0, 2).map(String),
|
||||
},
|
||||
{
|
||||
tagGroupId: filterGroupIds[1].toString(),
|
||||
tagIds: [filterTagIds[2].toString()],
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(acrossGroups.items.map((item) => item.goodName)).toContain(`Pub High ${stamp}`);
|
||||
expect(acrossGroups.items.map((item) => item.goodName)).not.toContain(`Pub Mid ${stamp}`);
|
||||
@@ -274,7 +283,12 @@ describe('PublicService', () => {
|
||||
service.getGoods({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
tagIds: [`${filterGroupIds[1]}:${filterTagIds[0]}`],
|
||||
tags: [
|
||||
{
|
||||
tagGroupId: filterGroupIds[1].toString(),
|
||||
tagIds: [filterTagIds[0].toString()],
|
||||
},
|
||||
],
|
||||
}),
|
||||
).rejects.toBeInstanceOf(BadRequestException);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user