@@ -66,8 +66,10 @@ describe('Product Projection', () => {
6666
6767 expect ( response . status ) . toBe ( 404 )
6868 } )
69+ } )
6970
70- test ( 'Search product projection' , async ( ) => {
71+ describe ( 'Product Projection Search' , ( ) => {
72+ beforeAll ( ( ) => {
7173 ctMock . project ( 'dummy' ) . add ( 'product-projection' , {
7274 id : '' ,
7375 version : 1 ,
@@ -83,7 +85,9 @@ describe('Product Projection', () => {
8385 lastModifiedAt : '' ,
8486 categories : [ ] ,
8587 } )
88+ } )
8689
90+ test ( 'Search product projection' , async ( ) => {
8791 const response = await supertest ( ctMock . app ) . get (
8892 '/dummy/product-projections/search?' +
8993 qs . stringify ( {
@@ -113,4 +117,31 @@ describe('Product Projection', () => {
113117 ] ,
114118 } )
115119 } )
120+
121+ test ( 'Search product projection with query.filter' , async ( ) => {
122+ const response = await supertest ( ctMock . app ) . get (
123+ '/dummy/product-projections/search?' +
124+ qs . stringify ( {
125+ 'query.filter' : [ 'masterVariant.sku:"1337"' ] ,
126+ } )
127+ )
128+
129+ const projection : ProductProjection = response . body
130+ expect ( projection ) . toMatchObject ( {
131+ count : 1 ,
132+ results : [ { masterVariant : { id : 1 , sku : '1337' } } ] ,
133+ } )
134+ } )
135+
136+ test ( 'Search product projection without filter' , async ( ) => {
137+ const response = await supertest ( ctMock . app ) . get (
138+ '/dummy/product-projections/search'
139+ )
140+
141+ const projection : ProductProjection = response . body
142+ expect ( projection ) . toMatchObject ( {
143+ count : 1 ,
144+ results : [ { masterVariant : { id : 1 , sku : '1337' } } ] ,
145+ } )
146+ } )
116147} )
0 commit comments