@@ -264,7 +264,6 @@ describe('UPDATE Milestone', () => {
264264 param : {
265265 name : 'Milestone 1-updated' ,
266266 duration : 3 ,
267- completionDate : '2018-05-16T00:00:00.000Z' ,
268267 description : 'description-updated' ,
269268 status : 'draft' ,
270269 type : 'type1-updated' ,
@@ -302,6 +301,30 @@ describe('UPDATE Milestone', () => {
302301 . expect ( 403 , done ) ;
303302 } ) ;
304303
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+
305328 it ( 'should return 404 for non-existed timeline' , ( done ) => {
306329 request ( server )
307330 . patch ( '/v4/timelines/1234/milestones/1' )
@@ -490,20 +513,22 @@ describe('UPDATE Milestone', () => {
490513 } ) ;
491514
492515 it ( 'should return 200 for admin' , ( done ) => {
516+ const newBody = _ . cloneDeep ( body ) ;
517+ newBody . param . completionDate = '2018-05-15T00:00:00.000Z' ;
493518 request ( server )
494519 . patch ( '/v4/timelines/1/milestones/1' )
495520 . set ( {
496521 Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
497522 } )
498- . send ( body )
523+ . send ( newBody )
499524 . expect ( 200 )
500525 . end ( ( err , res ) => {
501526 const resJson = res . body . result . content ;
502527 should . exist ( resJson . id ) ;
503528 resJson . name . should . be . eql ( body . param . name ) ;
504529 resJson . description . should . be . eql ( body . param . description ) ;
505530 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 ) ;
507532 resJson . status . should . be . eql ( body . param . status ) ;
508533 resJson . type . should . be . eql ( body . param . type ) ;
509534 resJson . details . should . be . eql ( {
@@ -1061,6 +1086,30 @@ describe('UPDATE Milestone', () => {
10611086 . end ( done ) ;
10621087 } ) ;
10631088
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+
10641113 it ( 'should return 200 for connect manager' , ( done ) => {
10651114 request ( server )
10661115 . patch ( '/v4/timelines/1/milestones/1' )
0 commit comments