@@ -125,7 +125,9 @@ describe.each([{ permission: "Admin" }])(
125125 const searchClient = new MeiliSearch ( { host : HOST , apiKey : token } ) ;
126126
127127 // search
128- expect ( searchClient . index ( UID ) . search ( ) ) . resolves . not . toBeUndefined ( ) ;
128+ await expect (
129+ searchClient . index ( UID ) . search ( ) ,
130+ ) . resolves . not . toBeUndefined ( ) ;
129131 } ) ;
130132
131133 test ( `${ permission } key: Search in tenant token with custom api key` , async ( ) => {
@@ -144,7 +146,7 @@ describe.each([{ permission: "Admin" }])(
144146 const searchClient = new MeiliSearch ( { host : HOST , apiKey : token } ) ;
145147
146148 // search
147- expect ( searchClient . index ( UID ) . search ( ) ) . resolves . toBeDefined ( ) ;
149+ await expect ( searchClient . index ( UID ) . search ( ) ) . resolves . toBeDefined ( ) ;
148150 } ) ;
149151
150152 test ( `${ permission } key: Search in tenant token with expireAt` , async ( ) => {
@@ -162,7 +164,9 @@ describe.each([{ permission: "Admin" }])(
162164 expect ( JSON . parse ( decode64 ( payload ) ) . exp ) . toEqual (
163165 Math . floor ( date . getTime ( ) / 1000 ) ,
164166 ) ;
165- expect ( searchClient . index ( UID ) . search ( ) ) . resolves . not . toBeUndefined ( ) ;
167+ await expect (
168+ searchClient . index ( UID ) . search ( ) ,
169+ ) . resolves . not . toBeUndefined ( ) ;
166170 } ) ;
167171
168172 test ( `${ permission } key: Search in tenant token with expireAt value set in the past` , async ( ) => {
@@ -171,7 +175,7 @@ describe.each([{ permission: "Admin" }])(
171175 const { uid } = await client . getKey ( apiKey ) ;
172176 const date = new Date ( "December 17, 2000 03:24:00" ) ;
173177
174- expect (
178+ await expect (
175179 client . generateTenantToken ( uid , [ "*" ] , { expiresAt : date } ) ,
176180 ) . rejects . toThrow (
177181 `Meilisearch: The expiresAt field must be a date in the future.` ,
@@ -189,7 +193,9 @@ describe.each([{ permission: "Admin" }])(
189193 const searchClient = new MeiliSearch ( { host : HOST , apiKey : token } ) ;
190194
191195 // search
192- expect ( searchClient . index ( UID ) . search ( ) ) . resolves . not . toBeUndefined ( ) ;
196+ await expect (
197+ searchClient . index ( UID ) . search ( ) ,
198+ ) . resolves . not . toBeUndefined ( ) ;
193199 } ) ;
194200
195201 test ( `${ permission } key: Search in tenant token with specific index and specific rules` , async ( ) => {
@@ -209,7 +215,9 @@ describe.each([{ permission: "Admin" }])(
209215 const searchClient = new MeiliSearch ( { host : HOST , apiKey : token } ) ;
210216
211217 // search
212- expect ( searchClient . index ( UID ) . search ( ) ) . resolves . not . toBeUndefined ( ) ;
218+ await expect (
219+ searchClient . index ( UID ) . search ( ) ,
220+ ) . resolves . not . toBeUndefined ( ) ;
213221 } ) ;
214222
215223 test ( `${ permission } key: Search in tenant token with empty array throws an error` , async ( ) => {
@@ -246,7 +254,7 @@ describe.each([{ permission: "Admin" }])(
246254 const { uid } = await client . getKey ( apiKey ) ;
247255 const date = new Date ( "December 17, 2000 03:24:00" ) ;
248256
249- expect (
257+ await expect (
250258 client . generateTenantToken (
251259 uid ,
252260 { } ,
@@ -262,15 +270,15 @@ describe.each([{ permission: "Admin" }])(
262270 test ( `${ permission } key: Creates tenant token with wrong uid type throws an error` , async ( ) => {
263271 const client = await getClient ( permission ) ;
264272
265- expect ( client . generateTenantToken ( "1234" , [ "*" ] ) ) . rejects . toThrow (
273+ await expect ( client . generateTenantToken ( "1234" , [ "*" ] ) ) . rejects . toThrow (
266274 `Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().` ,
267275 ) ;
268276 } ) ;
269277
270- test ( `${ permission } key: Creates a tenant token with no api key in client and in parameters throws an error` , ( ) => {
278+ test ( `${ permission } key: Creates a tenant token with no api key in client and in parameters throws an error` , async ( ) => {
271279 const client = new MeiliSearch ( { host : HOST } ) ;
272280
273- expect ( client . generateTenantToken ( "123" , [ ] ) ) . rejects . toThrow (
281+ await expect ( client . generateTenantToken ( "123" , [ ] ) ) . rejects . toThrow (
274282 `Meilisearch: The API key used for the token generation must exist and be of type string.` ,
275283 ) ;
276284 } ) ;
0 commit comments