@@ -221,29 +221,30 @@ describe('Media batch testing 1', () => {
221
221
222
222
beforeAll ( ( done ) => {
223
223
bynder = new Bynder ( configs ) ;
224
- bynder . getAllMediaItems ( )
225
- . then ( ( data ) => {
226
- getAllAssetsResponse = data ;
227
- return bynder . getMediaList ( ) ;
228
- } )
229
- . then ( ( data ) => {
230
- getAssetsResponse = data ;
231
- return bynder . getMediaTotal ( ) ;
232
- } )
233
- . then ( ( data ) => {
234
- getAssetsTotal = data ;
235
- testAssetRandomIndex = Math . floor ( Math . random ( ) * getAllAssetsResponse . length ) ;
236
- testAssetId = getAllAssetsResponse [ testAssetRandomIndex ] . id ;
237
- testAssetDescriptionBackup = getAllAssetsResponse [ testAssetRandomIndex ] . description ;
238
- return bynder . editMedia ( {
239
- id : testAssetId ,
240
- description : testDescriptionString
224
+ bynder
225
+ . getAllMediaItems ( )
226
+ . then ( ( data ) => {
227
+ getAllAssetsResponse = data ;
228
+ return bynder . getMediaList ( ) ;
229
+ } )
230
+ . then ( ( data ) => {
231
+ getAssetsResponse = data ;
232
+ return bynder . getMediaTotal ( ) ;
233
+ } )
234
+ . then ( ( data ) => {
235
+ getAssetsTotal = data ;
236
+ testAssetRandomIndex = 2 ; // Math.floor(Math.random() * getAllAssetsResponse.length);
237
+ testAssetId = getAllAssetsResponse [ testAssetRandomIndex ] . id ;
238
+ testAssetDescriptionBackup = getAllAssetsResponse [ testAssetRandomIndex ] . description ;
239
+ return bynder . editMedia ( {
240
+ id : testAssetId ,
241
+ description : testDescriptionString
242
+ } ) ;
243
+ } )
244
+ . then ( ( data ) => {
245
+ editMediaResult = data ;
246
+ done ( ) ;
241
247
} ) ;
242
- } )
243
- . then ( ( data ) => {
244
- editMediaResult = data ;
245
- done ( ) ;
246
- } ) ;
247
248
} ) ;
248
249
249
250
it ( 'The variable getAllAssets should be defined' , ( ) => {
@@ -284,7 +285,7 @@ describe('Media batch testing 2', () => {
284
285
getAssetResponse = data ;
285
286
done ( ) ;
286
287
} ) ;
287
- } , 5000 ) ;
288
+ } , 5000 ) ; // Sometimes the API returns the old value if the query call is made immediately after the edit call
288
289
} ) ;
289
290
290
291
it ( 'Description was edited successfully' , ( ) => {
0 commit comments