-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: post new note without parentId passed #153
Conversation
- fixed multiple public key error
note_relations table if parent id passed
Alse fix test result for POST /note without parentId
parent id if it passed
Also added some tests and todos for PATCH method
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.
I think you should remove all code related to child-parent-relationship because is not a finished feature yet. Leave only part of the code with your new tests.
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.
Now looks perfect
}, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(expectedStatus); |
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.
does response have body? if it does, you should check if returned note contains appended data
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.
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.
so i check the returned id to be string with length > 0
where is this check?
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.
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.
these checks should be added to this test case as well
body: {}, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(expectedStatus); |
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.
no need to use expectedStatus
variable, you can just use number literal
body: {}, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(expectedStatus); |
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.
same about expectedStatus
expect(response?.json().message).toStrictEqual(expectedMessage); | ||
}); | ||
|
||
test.todo('Update note by public id with 200 status, user is creator of the note'); |
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.
there is already such test case
https://github.com/codex-team/notes.api/pull/153/files#diff-790dbfbfc3ab79faef562482e5930737d9b7c352b95e3a0784972d2429b66abfR249
* Update migrations * Update more migrations * fix of rename tables migrations - fixed `notes_settings` -> `note_settings` renaming - fixed `teams` -> `note_teams` renaming * test error fix cannot change owner of sequence "note_teams_id_seq" * deleted unwanted string deleted commented string --------- Co-authored-by: e11sy <[email protected]> (cherry picked from commit 317c682)
package-lock.json
Outdated
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 do you have this file updated?
}, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(expectedStatus); |
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.
so i check the returned id to be string with length > 0
where is this check?
expect(response?.statusCode).toBe(406); | ||
}); | ||
|
||
test('Returns status 406 when the public id does not exist', async () => { |
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.
what's the difference between this test case and the previous one?
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.
Remove irrelevant changes form PR please and reply to comments
}, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(expectedStatus); |
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.
these checks should be added to this test case as well
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 is this file changed?
Closed to be reassigned |
Added two test for POST /note endpoint. Test "Post a new note without parentId passed" checks that POST request retrieves with 200 status code and created note publicId. Test "Returns status 401 when the user is not authorized" checks that status code of POST request is 401 when authorization data wasn't provided.