|
|
@@ -169,9 +169,11 @@ describe('Elasticsearch plugin', () => {
|
|
|
|
|
|
it('matches by FacetValueFilters OR and AND', () => testMatchFacetValueFiltersOrWithAnd(shopClient));
|
|
|
|
|
|
- it('matches by FacetValueFilters with facetId OR operator', () => testMatchFacetValueFiltersWithFacetIdsOr(shopClient));
|
|
|
+ it('matches by FacetValueFilters with facetId OR operator', () =>
|
|
|
+ testMatchFacetValueFiltersWithFacetIdsOr(shopClient));
|
|
|
|
|
|
- it('matches by FacetValueFilters with facetId AND operator', () => testMatchFacetValueFiltersWithFacetIdsAnd(shopClient));
|
|
|
+ it('matches by FacetValueFilters with facetId AND operator', () =>
|
|
|
+ testMatchFacetValueFiltersWithFacetIdsAnd(shopClient));
|
|
|
|
|
|
it('matches by collectionId', () => testMatchCollectionId(shopClient));
|
|
|
|
|
|
@@ -269,6 +271,7 @@ describe('Elasticsearch plugin', () => {
|
|
|
SEARCH_PRODUCTS_SHOP,
|
|
|
{
|
|
|
input: {
|
|
|
+ term: 'Laptop 13 inch 8GB',
|
|
|
groupByProduct: false,
|
|
|
take: 1,
|
|
|
},
|
|
|
@@ -293,11 +296,11 @@ describe('Elasticsearch plugin', () => {
|
|
|
{
|
|
|
input: {
|
|
|
groupByProduct: false,
|
|
|
- take: 3,
|
|
|
+ take: 100,
|
|
|
},
|
|
|
},
|
|
|
);
|
|
|
- expect(result.search.items.map(i => i.productVariantId)).toEqual(['T_1', 'T_2', 'T_4']);
|
|
|
+ expect(result.search.items.map(i => i.productVariantId).includes('T_3')).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('encodes collectionIds', async () => {
|
|
|
@@ -333,9 +336,11 @@ describe('Elasticsearch plugin', () => {
|
|
|
|
|
|
it('matches by FacetValueFilters OR and AND', () => testMatchFacetValueFiltersOrWithAnd(shopClient));
|
|
|
|
|
|
- it('matches by FacetValueFilters with facetId OR operator', () => testMatchFacetValueFiltersWithFacetIdsOr(shopClient));
|
|
|
+ it('matches by FacetValueFilters with facetId OR operator', () =>
|
|
|
+ testMatchFacetValueFiltersWithFacetIdsOr(shopClient));
|
|
|
|
|
|
- it('matches by FacetValueFilters with facetId AND operator', () => testMatchFacetValueFiltersWithFacetIdsAnd(shopClient));
|
|
|
+ it('matches by FacetValueFilters with facetId AND operator', () =>
|
|
|
+ testMatchFacetValueFiltersWithFacetIdsAnd(shopClient));
|
|
|
|
|
|
it('matches by collectionId', () => testMatchCollectionId(adminClient));
|
|
|
|
|
|
@@ -488,14 +493,14 @@ describe('Elasticsearch plugin', () => {
|
|
|
groupByProduct: true,
|
|
|
});
|
|
|
|
|
|
- expect(result1.search.items.map(i => i.productName)).toEqual([
|
|
|
- 'Road Bike',
|
|
|
- 'Skipping Rope',
|
|
|
+ expect(result1.search.items.map(i => i.productName).sort()).toEqual([
|
|
|
'Boxing Gloves',
|
|
|
- 'Tent',
|
|
|
'Cruiser Skateboard',
|
|
|
'Football',
|
|
|
+ 'Road Bike',
|
|
|
'Running Shoe',
|
|
|
+ 'Skipping Rope',
|
|
|
+ 'Tent',
|
|
|
]);
|
|
|
|
|
|
const result2 = await doAdminSearchQuery(adminClient, {
|
|
|
@@ -503,14 +508,14 @@ describe('Elasticsearch plugin', () => {
|
|
|
groupByProduct: true,
|
|
|
});
|
|
|
|
|
|
- expect(result2.search.items.map(i => i.productName)).toEqual([
|
|
|
- 'Road Bike',
|
|
|
- 'Skipping Rope',
|
|
|
+ expect(result2.search.items.map(i => i.productName).sort()).toEqual([
|
|
|
'Boxing Gloves',
|
|
|
- 'Tent',
|
|
|
'Cruiser Skateboard',
|
|
|
'Football',
|
|
|
+ 'Road Bike',
|
|
|
'Running Shoe',
|
|
|
+ 'Skipping Rope',
|
|
|
+ 'Tent',
|
|
|
]);
|
|
|
});
|
|
|
|
|
|
@@ -552,11 +557,11 @@ describe('Elasticsearch plugin', () => {
|
|
|
collectionId: createCollection.id,
|
|
|
groupByProduct: true,
|
|
|
});
|
|
|
- expect(result.search.items.map(i => i.productName)).toEqual([
|
|
|
- 'Instant Camera',
|
|
|
+ expect(result.search.items.map(i => i.productName).sort()).toEqual([
|
|
|
'Camera Lens',
|
|
|
- 'Tripod',
|
|
|
+ 'Instant Camera',
|
|
|
'SLR Camera',
|
|
|
+ 'Tripod',
|
|
|
]);
|
|
|
});
|
|
|
|
|
|
@@ -742,11 +747,13 @@ describe('Elasticsearch plugin', () => {
|
|
|
await adminClient.query<Reindex.Mutation>(REINDEX);
|
|
|
|
|
|
await awaitRunningJobs(adminClient);
|
|
|
- const result = await doAdminSearchQuery(adminClient, { groupByProduct: true, take: 3 });
|
|
|
+ const result = await doAdminSearchQuery(adminClient, {
|
|
|
+ term: 'laptop',
|
|
|
+ groupByProduct: true,
|
|
|
+ take: 3,
|
|
|
+ });
|
|
|
expect(result.search.items.map(pick(['productId', 'enabled']))).toEqual([
|
|
|
{ productId: 'T_1', enabled: false },
|
|
|
- { productId: 'T_2', enabled: true },
|
|
|
- { productId: 'T_3', enabled: false },
|
|
|
]);
|
|
|
});
|
|
|
});
|