@@ -1029,7 +1029,19 @@ describe("Tasks", function () {
1029
1029
expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Please contact admin." ) ;
1030
1030
} ) ;
1031
1031
1032
- it ( "Should give 400 if percentCompleted is not 100 and new status is DONE" , async function ( ) {
1032
+ it ( "Should give 400 if percentCompleted is not 100 and new status is COMPLETED " , async function ( ) {
1033
+ taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW" , assignee : appOwner . username } ) ) . taskId ;
1034
+ const res = await chai
1035
+ . request ( app )
1036
+ . patch ( `/tasks/self/${ taskId } ` )
1037
+ . set ( "cookie" , `${ cookieName } =${ jwt } ` )
1038
+ . send ( { ...taskStatusData , status : "COMPLETED" } ) ;
1039
+
1040
+ expect ( res ) . to . have . status ( 400 ) ;
1041
+ expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not completed yet" ) ;
1042
+ } ) ;
1043
+
1044
+ it ( "Should give 400 if percentCompleted is not 100 and new status is DONE under feature flag " , async function ( ) {
1033
1045
taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW" , assignee : appOwner . username } ) ) . taskId ;
1034
1046
const res = await chai
1035
1047
. request ( app )
@@ -1041,7 +1053,19 @@ describe("Tasks", function () {
1041
1053
expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not done yet" ) ;
1042
1054
} ) ;
1043
1055
1044
- it ( "Should give 400 if percentCompleted is not 100 and new status is VERIFIED" , async function ( ) {
1056
+ it ( "Should give 400 if percentCompleted is not 100 and new status is VERIFIED " , async function ( ) {
1057
+ taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW" , assignee : appOwner . username } ) ) . taskId ;
1058
+ const res = await chai
1059
+ . request ( app )
1060
+ . patch ( `/tasks/self/${ taskId } ` )
1061
+ . set ( "cookie" , `${ cookieName } =${ jwt } ` )
1062
+ . send ( { ...taskStatusData , status : "VERIFIED" } ) ;
1063
+
1064
+ expect ( res ) . to . have . status ( 400 ) ;
1065
+ expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not completed yet" ) ;
1066
+ } ) ;
1067
+
1068
+ it ( "Should give 400 if percentCompleted is not 100 and new status is VERIFIED under feature flag" , async function ( ) {
1045
1069
taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW" , assignee : appOwner . username } ) ) . taskId ;
1046
1070
const res = await chai
1047
1071
. request ( app )
@@ -1053,7 +1077,32 @@ describe("Tasks", function () {
1053
1077
expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not done yet" ) ;
1054
1078
} ) ;
1055
1079
1056
- it ( "Should give 400 if status is DONE and newpercent is less than 100" , async function ( ) {
1080
+ it ( "Should give 400 if status is COMPLETED and newpercent is less than 100" , async function ( ) {
1081
+ const taskData = {
1082
+ title : "Test task" ,
1083
+ type : "feature" ,
1084
+ endsOn : 1234 ,
1085
+ startedOn : 4567 ,
1086
+ status : "completed" ,
1087
+ percentCompleted : 100 ,
1088
+ participants : [ ] ,
1089
+ assignee : appOwner . username ,
1090
+ completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
1091
+ lossRate : { [ DINERO ] : 1 } ,
1092
+ isNoteworthy : true ,
1093
+ } ;
1094
+ taskId = ( await tasks . updateTask ( taskData ) ) . taskId ;
1095
+ const res = await chai
1096
+ . request ( app )
1097
+ . patch ( `/tasks/self/${ taskId } ` )
1098
+ . set ( "cookie" , `${ cookieName } =${ jwt } ` )
1099
+ . send ( { percentCompleted : 80 } ) ;
1100
+
1101
+ expect ( res ) . to . have . status ( 400 ) ;
1102
+ expect ( res . body . message ) . to . be . equal ( "Task percentCompleted can't updated as status is COMPLETED" ) ;
1103
+ } ) ;
1104
+
1105
+ it ( "Should give 400 if status is DONE and newpercent is less than 100 under feature flag" , async function ( ) {
1057
1106
taskId = ( await tasks . updateTask ( updateTaskStatus [ 0 ] ) ) . taskId ;
1058
1107
const res = await chai
1059
1108
. request ( app )
0 commit comments