-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create test route task #102
Conversation
__tests__/task.test.ts
Outdated
import { | ||
afterAll, beforeEach, describe, test, expect, | ||
} from '@jest/globals'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest puts each of these methods into the global environment so u don't have to import anything to use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks.
__tests__/task.test.ts
Outdated
.send({ | ||
title: 'add query tasks', | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read the taskSchema
again and update the request body here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, updated it.
__tests__/task.test.ts
Outdated
|
||
test('Should return 200 when add task', (done) => { | ||
supertest(app) | ||
.post('/project/10/task') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do u have project id 10 in ur database? if yes, do u have a manager role? please check to pass the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I'm sure
__tests__/task.test.ts
Outdated
.send({ | ||
title: 'add query tasks', | ||
}) | ||
.expect(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200 or 201?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
201 because it created or added task.
__tests__/task.test.ts
Outdated
.end((err, res) => { | ||
if (err) return done(err); | ||
expect(res.body.message).toEqual('Task added successfully'); | ||
expect(res.body.data).toBe('array'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res.body.data
does this return a text with value "array"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, without single quote or deleted it
} catch (err) { | ||
console.log('DB Error: ', err); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you create this file? Khaled created it already, delete it please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, deleted it.
No description provided.