@@ -264,7 +264,6 @@ describe('UPDATE Milestone', () => {
264
264
param : {
265
265
name : 'Milestone 1-updated' ,
266
266
duration : 3 ,
267
- completionDate : '2018-05-16T00:00:00.000Z' ,
268
267
description : 'description-updated' ,
269
268
status : 'draft' ,
270
269
type : 'type1-updated' ,
@@ -302,6 +301,30 @@ describe('UPDATE Milestone', () => {
302
301
. expect ( 403 , done ) ;
303
302
} ) ;
304
303
304
+ it ( 'should return 403 for non-admin member updating the completionDate' , ( done ) => {
305
+ const newBody = _ . cloneDeep ( body ) ;
306
+ newBody . param . completionDate = '2019-01-16T00:00:00.000Z' ;
307
+ request ( server )
308
+ . patch ( '/v4/timelines/1/milestones/1' )
309
+ . set ( {
310
+ Authorization : `Bearer ${ testUtil . jwts . manager } ` ,
311
+ } )
312
+ . send ( newBody )
313
+ . expect ( 403 , done ) ;
314
+ } ) ;
315
+
316
+ it ( 'should return 403 for non-admin member updating the actualStartDate' , ( done ) => {
317
+ const newBody = _ . cloneDeep ( body ) ;
318
+ newBody . param . actualStartDate = '2018-05-15T00:00:00.000Z' ;
319
+ request ( server )
320
+ . patch ( '/v4/timelines/1/milestones/1' )
321
+ . set ( {
322
+ Authorization : `Bearer ${ testUtil . jwts . manager } ` ,
323
+ } )
324
+ . send ( newBody )
325
+ . expect ( 403 , done ) ;
326
+ } ) ;
327
+
305
328
it ( 'should return 404 for non-existed timeline' , ( done ) => {
306
329
request ( server )
307
330
. patch ( '/v4/timelines/1234/milestones/1' )
@@ -490,20 +513,22 @@ describe('UPDATE Milestone', () => {
490
513
} ) ;
491
514
492
515
it ( 'should return 200 for admin' , ( done ) => {
516
+ const newBody = _ . cloneDeep ( body ) ;
517
+ newBody . param . completionDate = '2018-05-15T00:00:00.000Z' ;
493
518
request ( server )
494
519
. patch ( '/v4/timelines/1/milestones/1' )
495
520
. set ( {
496
521
Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
497
522
} )
498
- . send ( body )
523
+ . send ( newBody )
499
524
. expect ( 200 )
500
525
. end ( ( err , res ) => {
501
526
const resJson = res . body . result . content ;
502
527
should . exist ( resJson . id ) ;
503
528
resJson . name . should . be . eql ( body . param . name ) ;
504
529
resJson . description . should . be . eql ( body . param . description ) ;
505
530
resJson . duration . should . be . eql ( body . param . duration ) ;
506
- resJson . completionDate . should . be . eql ( body . param . completionDate ) ;
531
+ resJson . completionDate . should . be . eql ( newBody . param . completionDate ) ;
507
532
resJson . status . should . be . eql ( body . param . status ) ;
508
533
resJson . type . should . be . eql ( body . param . type ) ;
509
534
resJson . details . should . be . eql ( {
@@ -1061,6 +1086,30 @@ describe('UPDATE Milestone', () => {
1061
1086
. end ( done ) ;
1062
1087
} ) ;
1063
1088
1089
+ it ( 'should return 200 for admin updating the completionDate' , ( done ) => {
1090
+ const newBody = _ . cloneDeep ( body ) ;
1091
+ newBody . param . completionDate = '2018-05-16T00:00:00.000Z' ;
1092
+ request ( server )
1093
+ . patch ( '/v4/timelines/1/milestones/1' )
1094
+ . set ( {
1095
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
1096
+ } )
1097
+ . send ( newBody )
1098
+ . expect ( 200 , done ) ;
1099
+ } ) ;
1100
+
1101
+ it ( 'should return 200 for admin updating the actualStartDate' , ( done ) => {
1102
+ const newBody = _ . cloneDeep ( body ) ;
1103
+ newBody . param . actualStartDate = '2018-05-15T00:00:00.000Z' ;
1104
+ request ( server )
1105
+ . patch ( '/v4/timelines/1/milestones/1' )
1106
+ . set ( {
1107
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
1108
+ } )
1109
+ . send ( newBody )
1110
+ . expect ( 200 , done ) ;
1111
+ } ) ;
1112
+
1064
1113
it ( 'should return 200 for connect manager' , ( done ) => {
1065
1114
request ( server )
1066
1115
. patch ( '/v4/timelines/1/milestones/1' )
0 commit comments