Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Create test route task #102

wants to merge 2 commits into from

Conversation

Mohammed-Sbeata
Copy link
Collaborator

No description provided.

@Mohammed-Sbeata Mohammed-Sbeata self-assigned this Jun 18, 2023
@Mohammed-Sbeata Mohammed-Sbeata linked an issue Jun 18, 2023 that may be closed by this pull request
@Mohammed-Sbeata Mohammed-Sbeata changed the title feat: create test route task Create test route task Jun 18, 2023
Comment on lines 3 to 5
import {
afterAll, beforeEach, describe, test, expect,
} from '@jest/globals';
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks.

Comment on lines 57 to 59
.send({
title: 'add query tasks',
})
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, updated it.


test('Should return 200 when add task', (done) => {
supertest(app)
.post('/project/10/task')
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'm sure

.send({
title: 'add query tasks',
})
.expect(200)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

200 or 201?

Copy link
Collaborator Author

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.

.end((err, res) => {
if (err) return done(err);
expect(res.body.message).toEqual('Task added successfully');
expect(res.body.data).toBe('array');
Copy link
Contributor

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"?

Copy link
Collaborator Author

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);
}
};
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, deleted it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create test for task route
2 participants