@@ -18,7 +18,6 @@ const tasksData = require("../fixtures/tasks/tasks")();
18
18
const { DINERO , NEELAM } = require ( "../../constants/wallets" ) ;
19
19
const cleanDb = require ( "../utils/cleanDb" ) ;
20
20
const { TASK_STATUS , tasksUsersStatus } = require ( "../../constants/tasks" ) ;
21
- const updateTaskStatus = require ( "../fixtures/tasks/tasks1" ) ( ) ;
22
21
const userStatusData = require ( "../fixtures/userStatus/userStatus" ) ;
23
22
const tasksModel = firestore . collection ( "tasks" ) ;
24
23
const discordService = require ( "../../services/discordService" ) ;
@@ -1121,19 +1120,19 @@ describe("Tasks", function () {
1121
1120
. send ( { ...taskStatusData , status : "COMPLETED" } ) ;
1122
1121
1123
1122
expect ( res ) . to . have . status ( 400 ) ;
1124
- expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not completed yet " ) ;
1123
+ expect ( res . body . message ) . to . be . equal ( "Status cannot be updated as progress of task is not 100%. " ) ;
1125
1124
} ) ;
1126
1125
1127
- it ( "Should give 400 if percentCompleted is not 100 and new status is DONE under feature flag " , async function ( ) {
1128
- taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW " , assignee : appOwner . username } ) ) . taskId ;
1126
+ it ( "Should give 403 if current task status is DONE" , async function ( ) {
1127
+ taskId = ( await tasks . updateTask ( { ...taskData , status : "DONE " , assignee : appOwner . username } ) ) . taskId ;
1129
1128
const res = await chai
1130
1129
. request ( app )
1131
1130
. patch ( `/tasks/self/${ taskId } ?userStatusFlag=true` )
1132
1131
. set ( "cookie" , `${ cookieName } =${ jwt } ` )
1133
- . send ( { ...taskStatusData , status : "DONE " } ) ;
1132
+ . send ( { ...taskStatusData , status : "IN_REVIEW " } ) ;
1134
1133
1135
- expect ( res ) . to . have . status ( 400 ) ;
1136
- expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not done yet" ) ;
1134
+ expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Please contact admin." ) ;
1135
+ expect ( res ) . to . have . status ( 403 ) ;
1137
1136
} ) ;
1138
1137
1139
1138
it ( "Should give 400 if percentCompleted is not 100 and new status is VERIFIED " , async function ( ) {
@@ -1145,19 +1144,7 @@ describe("Tasks", function () {
1145
1144
. send ( { ...taskStatusData , status : "VERIFIED" } ) ;
1146
1145
1147
1146
expect ( res ) . to . have . status ( 400 ) ;
1148
- expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not completed yet" ) ;
1149
- } ) ;
1150
-
1151
- it ( "Should give 400 if percentCompleted is not 100 and new status is VERIFIED under feature flag" , async function ( ) {
1152
- taskId = ( await tasks . updateTask ( { ...taskData , status : "REVIEW" , assignee : appOwner . username } ) ) . taskId ;
1153
- const res = await chai
1154
- . request ( app )
1155
- . patch ( `/tasks/self/${ taskId } ?userStatusFlag=true` )
1156
- . set ( "cookie" , `${ cookieName } =${ jwt } ` )
1157
- . send ( { ...taskStatusData , status : "VERIFIED" } ) ;
1158
-
1159
- expect ( res ) . to . have . status ( 400 ) ;
1160
- expect ( res . body . message ) . to . be . equal ( "Status cannot be updated. Task is not done yet" ) ;
1147
+ expect ( res . body . message ) . to . be . equal ( "Status cannot be updated as progress of task is not 100%." ) ;
1161
1148
} ) ;
1162
1149
1163
1150
it ( "Should give 400 if status is COMPLETED and newpercent is less than 100" , async function ( ) {
@@ -1184,18 +1171,6 @@ describe("Tasks", function () {
1184
1171
expect ( res ) . to . have . status ( 400 ) ;
1185
1172
expect ( res . body . message ) . to . be . equal ( "Task percentCompleted can't updated as status is COMPLETED" ) ;
1186
1173
} ) ;
1187
-
1188
- it ( "Should give 400 if status is DONE and newpercent is less than 100 under feature flag" , async function ( ) {
1189
- taskId = ( await tasks . updateTask ( updateTaskStatus [ 0 ] ) ) . taskId ;
1190
- const res = await chai
1191
- . request ( app )
1192
- . patch ( `/tasks/self/${ taskId } ?userStatusFlag=true` )
1193
- . set ( "cookie" , `${ cookieName } =${ jwt } ` )
1194
- . send ( { percentCompleted : 80 } ) ;
1195
-
1196
- expect ( res ) . to . have . status ( 400 ) ;
1197
- expect ( res . body . message ) . to . be . equal ( "Task percentCompleted can't updated as status is DONE" ) ;
1198
- } ) ;
1199
1174
} ) ;
1200
1175
1201
1176
describe ( "GET /tasks/overdue" , function ( ) {
0 commit comments