@@ -24,40 +24,6 @@ const superUser = userData[4];
24
24
25
25
let jwt , superUserJwt ;
26
26
27
- const taskData = [
28
- {
29
- title : "Test task" ,
30
- type : "feature" ,
31
- endsOn : 1234 ,
32
- startedOn : 4567 ,
33
- status : "IN_PROGRESS" ,
34
- percentCompleted : 10 ,
35
- participants : [ ] ,
36
- assignee : appOwner . username ,
37
- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
38
- lossRate : { [ DINERO ] : 1 } ,
39
- isNoteworthy : true ,
40
- isCollapsed : true ,
41
- } ,
42
- {
43
- title : "Test task" ,
44
- purpose : "To Test mocha" ,
45
- featureUrl : "<testUrl>" ,
46
- type : "group" ,
47
- links : [ "test1" ] ,
48
- endsOn : 1234 ,
49
- startedOn : 54321 ,
50
- status : "completed" ,
51
- percentCompleted : 10 ,
52
- dependsOn : [ "d12" , "d23" ] ,
53
- participants : [ appOwner . username ] ,
54
- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
55
- lossRate : { [ DINERO ] : 1 } ,
56
- isNoteworthy : false ,
57
- assignee : appOwner . username ,
58
- } ,
59
- ] ;
60
-
61
27
describe ( "Tasks" , function ( ) {
62
28
let taskId1 , taskId ;
63
29
@@ -67,6 +33,40 @@ describe("Tasks", function () {
67
33
jwt = authService . generateAuthToken ( { userId } ) ;
68
34
superUserJwt = authService . generateAuthToken ( { userId : superUserId } ) ;
69
35
36
+ const taskData = [
37
+ {
38
+ title : "Test task" ,
39
+ type : "feature" ,
40
+ endsOn : 1234 ,
41
+ startedOn : 4567 ,
42
+ status : "IN_PROGRESS" ,
43
+ percentCompleted : 10 ,
44
+ participants : [ ] ,
45
+ assignee : appOwner . username ,
46
+ completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
47
+ lossRate : { [ DINERO ] : 1 } ,
48
+ isNoteworthy : true ,
49
+ isCollapsed : true ,
50
+ } ,
51
+ {
52
+ title : "Test task" ,
53
+ purpose : "To Test mocha" ,
54
+ featureUrl : "<testUrl>" ,
55
+ type : "group" ,
56
+ links : [ "test1" ] ,
57
+ endsOn : 1234 ,
58
+ startedOn : 54321 ,
59
+ status : "completed" ,
60
+ percentCompleted : 10 ,
61
+ dependsOn : [ "d12" , "d23" ] ,
62
+ participants : [ appOwner . username ] ,
63
+ completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
64
+ lossRate : { [ DINERO ] : 1 } ,
65
+ isNoteworthy : false ,
66
+ assignee : appOwner . username ,
67
+ } ,
68
+ ] ;
69
+
70
70
// Add the active task
71
71
taskId = ( await tasks . updateTask ( taskData [ 0 ] ) ) . taskId ;
72
72
taskId1 = taskId ;
@@ -184,11 +184,6 @@ describe("Tasks", function () {
184
184
} ) ;
185
185
186
186
describe ( "GET /tasks" , function ( ) {
187
- before ( async function ( ) {
188
- await tasks . updateTask ( { ...taskData [ 0 ] , createdAt : 1621717694 , updatedAt : 1700680830 } ) ;
189
- await tasks . updateTask ( { ...taskData [ 1 ] , createdAt : 1621717694 , updatedAt : 1700775753 } ) ;
190
- } ) ;
191
-
192
187
it ( "Should get all the list of tasks" , function ( done ) {
193
188
chai
194
189
. request ( app )
@@ -353,6 +348,7 @@ describe("Tasks", function () {
353
348
if ( err ) {
354
349
return done ( err ) ;
355
350
}
351
+
356
352
expect ( res ) . to . have . status ( 200 ) ;
357
353
expect ( res . body ) . to . be . a ( "object" ) ;
358
354
expect ( res . body . message ) . to . equal ( "Tasks returned successfully!" ) ;
@@ -413,7 +409,7 @@ describe("Tasks", function () {
413
409
matchingTasks . forEach ( ( task ) => {
414
410
expect ( task . title . toLowerCase ( ) ) . to . include ( searchTerm . toLowerCase ( ) ) ;
415
411
} ) ;
416
- expect ( matchingTasks ) . to . have . length ( 6 ) ;
412
+ expect ( matchingTasks ) . to . have . length ( 4 ) ;
417
413
418
414
return done ( ) ;
419
415
} ) ;
@@ -452,26 +448,6 @@ describe("Tasks", function () {
452
448
return done ( ) ;
453
449
} ) ;
454
450
} ) ;
455
- it ( "Should get paginated tasks ordered by updatedAt in desc order " , function ( done ) {
456
- chai
457
- . request ( app )
458
- . get ( "/tasks?dev=true&size=5&page=0" )
459
- . end ( ( err , res ) => {
460
- if ( err ) {
461
- return done ( err ) ;
462
- }
463
- expect ( res ) . to . have . status ( 200 ) ;
464
- expect ( res . body ) . to . be . a ( "object" ) ;
465
- expect ( res . body . message ) . to . equal ( "Tasks returned successfully!" ) ;
466
- expect ( res . body . tasks ) . to . be . a ( "array" ) ;
467
- const tasks = res . body . tasks ;
468
- // Check if Tasks are returned in desc order of updatedAt field
469
- for ( let i = 0 ; i < tasks . length - 1 ; i ++ ) {
470
- expect ( tasks [ + i ] . updatedAt ) . to . be . greaterThanOrEqual ( tasks [ i + 1 ] . updatedAt ) ;
471
- }
472
- return done ( ) ;
473
- } ) ;
474
- } ) ;
475
451
} ) ;
476
452
477
453
describe ( "GET /tasks/:id/details" , function ( ) {
0 commit comments