@@ -358,7 +358,7 @@ describe('Tests content types', () => {
358358 } )
359359
360360 expect (
361- customStrapi . plugin ( ) . service ( ) . actionInBatches
361+ customStrapi . plugin ( ) . service ( ) . actionInBatches ,
362362 ) . toHaveBeenCalledWith ( {
363363 contentType : 'restaurant' ,
364364 callback : expect . anything ( ) ,
@@ -373,7 +373,7 @@ describe('Tests content types', () => {
373373 } )
374374 expect ( customStrapi . log . info ) . toHaveBeenCalledTimes ( 1 )
375375 expect ( customStrapi . log . info ) . toHaveBeenCalledWith (
376- 'A task to update the settings to the Meilisearch index "customIndex" has been enqueued (Task uid: undefined).'
376+ 'A task to update the settings to the Meilisearch index "customIndex" has been enqueued (Task uid: undefined).' ,
377377 )
378378 } )
379379
@@ -401,7 +401,7 @@ describe('Tests content types', () => {
401401 } )
402402
403403 expect (
404- customStrapi . plugin ( ) . service ( ) . actionInBatches
404+ customStrapi . plugin ( ) . service ( ) . actionInBatches ,
405405 ) . toHaveBeenCalledWith ( {
406406 contentType : 'restaurant' ,
407407 callback : expect . anything ( ) ,
@@ -416,10 +416,10 @@ describe('Tests content types', () => {
416416 } )
417417 expect ( customStrapi . log . info ) . toHaveBeenCalledTimes ( 2 )
418418 expect ( customStrapi . log . info ) . toHaveBeenCalledWith (
419- 'A task to update the settings to the Meilisearch index "customIndex" has been enqueued (Task uid: undefined).'
419+ 'A task to update the settings to the Meilisearch index "customIndex" has been enqueued (Task uid: undefined).' ,
420420 )
421421 expect ( customStrapi . log . info ) . toHaveBeenCalledWith (
422- 'A task to update the settings to the Meilisearch index "anotherIndex" has been enqueued (Task uid: undefined).'
422+ 'A task to update the settings to the Meilisearch index "anotherIndex" has been enqueued (Task uid: undefined).' ,
423423 )
424424 } )
425425
@@ -587,4 +587,25 @@ describe('Tests content types', () => {
587587
588588 expect ( result ) . toEqual ( [ 'api::restaurant.restaurant' ] )
589589 } )
590+
591+ test ( 'Test to get content types with same index, edge case with multiple indexes' , async ( ) => {
592+ const customStrapi = createStrapiMock ( {
593+ restaurantConfig : {
594+ indexName : [ 'customIndex' ] ,
595+ } ,
596+ aboutConfig : {
597+ indexName : [ 'customIndex' , 'anotherIndex' ] ,
598+ } ,
599+ } )
600+
601+ const meilisearchService = createMeilisearchService ( {
602+ strapi : customStrapi ,
603+ } )
604+
605+ const result = await meilisearchService . getContentTypesWithSameIndex ( {
606+ contentType : 'restaurant' ,
607+ } )
608+
609+ expect ( result ) . toEqual ( [ 'api::restaurant.restaurant' , 'api::about.about' ] )
610+ } )
590611} )
0 commit comments