Skip to content

Commit 9f9ce31

Browse files
committed
Update test cases for tasks
1 parent e0290dd commit 9f9ce31

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

test/integration/tasksController.test.js

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,35 @@ const tasks = require('../../models/tasks')
99
chai.use(chaiHttp)
1010

1111
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+
1241
afterEach(function () {
1342
sinon.restore()
1443
})
@@ -23,6 +52,9 @@ describe('Tasks', function () {
2352
.request(app)
2453
.post('/tasks')
2554
.send({
55+
title: 'Test Task',
56+
purpose: 'To Test mocha',
57+
featureUrl: '<testUrl>',
2658
type: 'Dev | Group',
2759
links: [
2860
'test1'
@@ -38,7 +70,8 @@ describe('Tasks', function () {
3870
],
3971
participants: ['id1'],
4072
completionAward: { gold: 3, bronze: 300 },
41-
lossRate: { gold: 1 }
73+
lossRate: { gold: 1 },
74+
isNoteWorthy: true
4275
})
4376
.end((err, res) => {
4477
if (err) { return done() }
@@ -58,6 +91,9 @@ describe('Tasks', function () {
5891
sinon.stub(tasks, 'fetchTasks').callsFake((query) => {
5992
return [
6093
{
94+
title: 'Test Task',
95+
purpose: 'To Test mocha',
96+
featureUrl: '<testUrl>',
6197
type: 'Dev | Group',
6298
links: [
6399
'test1'
@@ -68,12 +104,13 @@ describe('Tasks', function () {
68104
ownerId: '<app owner user id>',
69105
percentCompleted: 10,
70106
dependsOn: [
71-
'd1',
72-
'd2'
107+
'd12',
108+
'd23'
73109
],
74110
participants: ['id1'],
75111
completionAward: { gold: 3, bronze: 300 },
76-
lossRate: { gold: 1 }
112+
lossRate: { gold: 1 },
113+
isNoteWorthy: true
77114
}
78115
]
79116
})
@@ -101,7 +138,7 @@ describe('Tasks', function () {
101138

102139
chai
103140
.request(app)
104-
.patch('/tasks/78xu384O5TurRxZ58AjV')
141+
.patch('/tasks/' + tid)
105142
.send({
106143
ownerId: 'sumit'
107144
})

0 commit comments

Comments
 (0)