@@ -113,7 +113,7 @@ describe('Test plugin configuration', () => {
113113 expect ( strapiMock . log . error ) . toHaveBeenCalledTimes ( 0 )
114114 } )
115115
116- test ( 'Test indexName with string' , async ( ) => {
116+ test ( 'Test indexName with empty string' , async ( ) => {
117117 validatePluginConfig ( {
118118 restaurant : {
119119 indexName : '' ,
@@ -122,14 +122,50 @@ describe('Test plugin configuration', () => {
122122 expect ( strapiMock . log . warn ) . toHaveBeenCalledTimes ( 0 )
123123 expect ( strapiMock . log . error ) . toHaveBeenCalledTimes ( 1 )
124124 expect ( strapiMock . log . error ) . toHaveBeenCalledWith (
125- 'The "indexName" option of "restaurant" should be a non-empty array of strings' ,
125+ 'The "indexName" option of "restaurant" should be a non-empty string or an array of non-empty strings' ,
126126 )
127127 } )
128128
129- test ( 'Test indexName with non-empty array ' , async ( ) => {
129+ test ( 'Test indexName with non-empty string ' , async ( ) => {
130130 validatePluginConfig ( {
131131 restaurant : {
132- indexName : [ 'hello' ] ,
132+ indexName : 'validName' ,
133+ } ,
134+ } )
135+ expect ( strapiMock . log . warn ) . toHaveBeenCalledTimes ( 0 )
136+ expect ( strapiMock . log . error ) . toHaveBeenCalledTimes ( 0 )
137+ } )
138+
139+ test ( 'Test indexName with empty array' , async ( ) => {
140+ validatePluginConfig ( {
141+ restaurant : {
142+ indexName : [ ] ,
143+ } ,
144+ } )
145+ expect ( strapiMock . log . warn ) . toHaveBeenCalledTimes ( 0 )
146+ expect ( strapiMock . log . error ) . toHaveBeenCalledTimes ( 1 )
147+ expect ( strapiMock . log . error ) . toHaveBeenCalledWith (
148+ 'The "indexName" option of "restaurant" should be a non-empty string or an array of non-empty strings' ,
149+ )
150+ } )
151+
152+ test ( 'Test indexName with non-empty array containing empty string' , async ( ) => {
153+ validatePluginConfig ( {
154+ restaurant : {
155+ indexName : [ '' ] ,
156+ } ,
157+ } )
158+ expect ( strapiMock . log . warn ) . toHaveBeenCalledTimes ( 0 )
159+ expect ( strapiMock . log . error ) . toHaveBeenCalledTimes ( 1 )
160+ expect ( strapiMock . log . error ) . toHaveBeenCalledWith (
161+ 'The "indexName" option of "restaurant" should be a non-empty string or an array of non-empty strings' ,
162+ )
163+ } )
164+
165+ test ( 'Test indexName with non-empty array of strings' , async ( ) => {
166+ validatePluginConfig ( {
167+ restaurant : {
168+ indexName : [ 'validName1' , 'validName2' ] ,
133169 } ,
134170 } )
135171 expect ( strapiMock . log . warn ) . toHaveBeenCalledTimes ( 0 )
0 commit comments