@@ -299,6 +299,9 @@ describe('LIST Project', () => {
299
299
} ) ;
300
300
301
301
return Promise . all ( [ p1 , p2 , p3 ] ) . then ( ( ) => {
302
+ data [ 0 ] . id = project1 . id ;
303
+ data [ 1 ] . id = project2 . id ;
304
+ data [ 2 ] . id = project3 . id ;
302
305
const esp1 = server . services . es . index ( {
303
306
index : ES_PROJECT_INDEX ,
304
307
type : ES_PROJECT_TYPE ,
@@ -377,7 +380,7 @@ describe('LIST Project', () => {
377
380
should . exist ( resJson ) ;
378
381
resJson . should . have . lengthOf ( 1 ) ;
379
382
// since project 2 is indexed with id 2
380
- resJson [ 0 ] . id . should . equal ( 2 ) ;
383
+ resJson [ 0 ] . id . should . equal ( project2 . id ) ;
381
384
done ( ) ;
382
385
}
383
386
} ) ;
@@ -484,9 +487,10 @@ describe('LIST Project', () => {
484
487
const resJson = res . body ;
485
488
should . exist ( resJson ) ;
486
489
resJson . should . have . lengthOf ( 3 ) ;
487
- resJson [ 0 ] . should . have . property ( 'attachments' ) ;
488
- resJson [ 0 ] . should . have . property ( 'description' ) ;
489
- resJson [ 0 ] . should . have . property ( 'billingAccountId' ) ;
490
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
491
+ project . should . have . property ( 'attachments' ) ;
492
+ project . should . have . property ( 'description' ) ;
493
+ project . should . have . property ( 'billingAccountId' ) ;
490
494
done ( ) ;
491
495
}
492
496
} ) ;
@@ -507,16 +511,17 @@ describe('LIST Project', () => {
507
511
const resJson = res . body ;
508
512
should . exist ( resJson ) ;
509
513
resJson . should . have . lengthOf ( 3 ) ;
510
- resJson [ 0 ] . should . have . property ( 'id' ) ;
511
- resJson [ 0 ] . should . have . property ( 'type' ) ;
512
- resJson [ 0 ] . should . have . property ( 'billingAccountId' ) ;
513
- resJson [ 0 ] . should . have . property ( 'description' ) ;
514
- resJson [ 0 ] . should . have . property ( 'status' ) ;
515
- resJson [ 0 ] . should . have . property ( 'details' ) ;
516
- resJson [ 0 ] . should . have . property ( 'createdBy' ) ;
517
- resJson [ 0 ] . should . have . property ( 'updatedBy' ) ;
518
- resJson [ 0 ] . should . have . property ( 'members' ) ;
519
- resJson [ 0 ] . should . have . property ( 'attachments' ) ;
514
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
515
+ project . should . have . property ( 'id' ) ;
516
+ project . should . have . property ( 'type' ) ;
517
+ project . should . have . property ( 'billingAccountId' ) ;
518
+ project . should . have . property ( 'description' ) ;
519
+ project . should . have . property ( 'status' ) ;
520
+ project . should . have . property ( 'details' ) ;
521
+ project . should . have . property ( 'createdBy' ) ;
522
+ project . should . have . property ( 'updatedBy' ) ;
523
+ project . should . have . property ( 'members' ) ;
524
+ project . should . have . property ( 'attachments' ) ;
520
525
done ( ) ;
521
526
}
522
527
} ) ;
@@ -606,7 +611,7 @@ describe('LIST Project', () => {
606
611
607
612
it ( 'should return project that match when filtering by id (exact)' , ( done ) => {
608
613
request ( server )
609
- . get ( ' /v5/projects/?id=1' )
614
+ . get ( ` /v5/projects/?id=${ project1 . id } ` )
610
615
. set ( {
611
616
Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
612
617
} )
@@ -619,7 +624,7 @@ describe('LIST Project', () => {
619
624
const resJson = res . body ;
620
625
should . exist ( resJson ) ;
621
626
resJson . should . have . lengthOf ( 1 ) ;
622
- resJson [ 0 ] . id . should . equal ( 1 ) ;
627
+ resJson [ 0 ] . id . should . equal ( project1 . id ) ;
623
628
resJson [ 0 ] . name . should . equal ( 'test1' ) ;
624
629
done ( ) ;
625
630
}
@@ -1216,7 +1221,7 @@ describe('LIST Project', () => {
1216
1221
} else {
1217
1222
const resJson = res . body ;
1218
1223
should . exist ( resJson ) ;
1219
- const project = _ . find ( resJson , p => p . id === 1 ) ;
1224
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1220
1225
const member = _ . find ( project . members , m => m . id === 1 ) ;
1221
1226
member . should . not . have . property ( 'email' ) ;
1222
1227
done ( ) ;
@@ -1239,7 +1244,7 @@ describe('LIST Project', () => {
1239
1244
} else {
1240
1245
const resJson = res . body ;
1241
1246
should . exist ( resJson ) ;
1242
- const project = _ . find ( resJson , p => p . id === 1 ) ;
1247
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1243
1248
const member = _ . find ( project . members , m => m . id === 1 ) ;
1244
1249
member . should . have . property ( 'email' ) ;
1245
1250
member . email . should . be . eq ( 'test@test.com' ) ;
@@ -1283,8 +1288,9 @@ describe('LIST Project', () => {
1283
1288
} else {
1284
1289
const resJson = res . body ;
1285
1290
should . exist ( resJson ) ;
1286
- resJson [ 0 ] . invites [ 0 ] . should . have . property ( 'userId' ) ;
1287
- _ . keys ( resJson [ 0 ] . invites [ 0 ] ) . length . should . be . eq ( 1 ) ;
1291
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1292
+ project . invites [ 0 ] . should . have . property ( 'userId' ) ;
1293
+ _ . keys ( project . invites [ 0 ] ) . length . should . be . eq ( 1 ) ;
1288
1294
done ( ) ;
1289
1295
}
1290
1296
} ) ;
@@ -1304,8 +1310,9 @@ describe('LIST Project', () => {
1304
1310
} else {
1305
1311
const resJson = res . body ;
1306
1312
should . exist ( resJson ) ;
1307
- resJson [ 0 ] . members [ 0 ] . should . have . property ( 'role' ) ;
1308
- _ . keys ( resJson [ 0 ] . members [ 0 ] ) . length . should . be . eq ( 1 ) ;
1313
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1314
+ project . members [ 0 ] . should . have . property ( 'role' ) ;
1315
+ _ . keys ( project . members [ 0 ] ) . length . should . be . eq ( 1 ) ;
1309
1316
done ( ) ;
1310
1317
}
1311
1318
} ) ;
@@ -1325,8 +1332,9 @@ describe('LIST Project', () => {
1325
1332
} else {
1326
1333
const resJson = res . body ;
1327
1334
should . exist ( resJson ) ;
1328
- resJson [ 0 ] . attachments [ 0 ] . should . have . property ( 'title' ) ;
1329
- _ . keys ( resJson [ 0 ] . attachments [ 0 ] ) . length . should . be . eq ( 1 ) ;
1335
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1336
+ project . attachments [ 0 ] . should . have . property ( 'title' ) ;
1337
+ _ . keys ( project . attachments [ 0 ] ) . length . should . be . eq ( 1 ) ;
1330
1338
done ( ) ;
1331
1339
}
1332
1340
} ) ;
@@ -1346,7 +1354,7 @@ describe('LIST Project', () => {
1346
1354
} else {
1347
1355
const resJson = res . body ;
1348
1356
should . exist ( resJson ) ;
1349
- const project = _ . find ( resJson , p => p . id === 1 ) ;
1357
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1350
1358
project . phases [ 0 ] . should . have . property ( 'name' ) ;
1351
1359
_ . keys ( project . phases [ 0 ] ) . length . should . be . eq ( 1 ) ;
1352
1360
done ( ) ;
@@ -1368,7 +1376,7 @@ describe('LIST Project', () => {
1368
1376
} else {
1369
1377
const resJson = res . body ;
1370
1378
should . exist ( resJson ) ;
1371
- const project = _ . find ( resJson , p => p . id === 1 ) ;
1379
+ const project = _ . find ( resJson , p => p . id === project1 . id ) ;
1372
1380
project . phases [ 0 ] . products [ 0 ] . should . have . property ( 'name' ) ;
1373
1381
_ . keys ( project . phases [ 0 ] . products [ 0 ] ) . length . should . be . eq ( 1 ) ;
1374
1382
done ( ) ;
0 commit comments