@@ -9,6 +9,35 @@ const tasks = require('../../models/tasks')
9
9
chai . use ( chaiHttp )
10
10
11
11
describe ( 'Tasks' , function ( ) {
12
+ let tid = ''
13
+ before ( async function ( ) {
14
+ this . enableTimeouts ( false )
15
+ const taskData = {
16
+ title : 'Test Task' ,
17
+ purpose : 'To Test mocha' ,
18
+ featureUrl : '<testUrl>' ,
19
+ type : 'Dev | Group' ,
20
+ links : [
21
+ 'test1'
22
+ ] ,
23
+ endsOn : '<unix timestamp>' ,
24
+ startedOn : '<unix timestamp>' ,
25
+ status : 'Active' ,
26
+ ownerId : '<app owner user id>' ,
27
+ percentCompleted : 10 ,
28
+ dependsOn : [
29
+ 'd12' ,
30
+ 'd23'
31
+ ] ,
32
+ participants : [ 'id1' ] ,
33
+ completionAward : { gold : 3 , bronze : 300 } ,
34
+ lossRate : { gold : 1 } ,
35
+ isNoteWorthy : true
36
+ }
37
+ const { taskId } = await tasks . updateTask ( taskData )
38
+ tid = taskId
39
+ } )
40
+
12
41
afterEach ( function ( ) {
13
42
sinon . restore ( )
14
43
} )
@@ -23,6 +52,9 @@ describe('Tasks', function () {
23
52
. request ( app )
24
53
. post ( '/tasks' )
25
54
. send ( {
55
+ title : 'Test Task' ,
56
+ purpose : 'To Test mocha' ,
57
+ featureUrl : '<testUrl>' ,
26
58
type : 'Dev | Group' ,
27
59
links : [
28
60
'test1'
@@ -38,7 +70,8 @@ describe('Tasks', function () {
38
70
] ,
39
71
participants : [ 'id1' ] ,
40
72
completionAward : { gold : 3 , bronze : 300 } ,
41
- lossRate : { gold : 1 }
73
+ lossRate : { gold : 1 } ,
74
+ isNoteWorthy : true
42
75
} )
43
76
. end ( ( err , res ) => {
44
77
if ( err ) { return done ( ) }
@@ -58,6 +91,9 @@ describe('Tasks', function () {
58
91
sinon . stub ( tasks , 'fetchTasks' ) . callsFake ( ( query ) => {
59
92
return [
60
93
{
94
+ title : 'Test Task' ,
95
+ purpose : 'To Test mocha' ,
96
+ featureUrl : '<testUrl>' ,
61
97
type : 'Dev | Group' ,
62
98
links : [
63
99
'test1'
@@ -68,12 +104,13 @@ describe('Tasks', function () {
68
104
ownerId : '<app owner user id>' ,
69
105
percentCompleted : 10 ,
70
106
dependsOn : [
71
- 'd1 ' ,
72
- 'd2 '
107
+ 'd12 ' ,
108
+ 'd23 '
73
109
] ,
74
110
participants : [ 'id1' ] ,
75
111
completionAward : { gold : 3 , bronze : 300 } ,
76
- lossRate : { gold : 1 }
112
+ lossRate : { gold : 1 } ,
113
+ isNoteWorthy : true
77
114
}
78
115
]
79
116
} )
@@ -101,7 +138,7 @@ describe('Tasks', function () {
101
138
102
139
chai
103
140
. request ( app )
104
- . patch ( '/tasks/78xu384O5TurRxZ58AjV' )
141
+ . patch ( '/tasks/' + tid )
105
142
. send ( {
106
143
ownerId : 'sumit'
107
144
} )
0 commit comments