-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
test(sample-01): added service unit tests #10623
Conversation
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.
thank you for your suggestion.
There are couple things to change, tho.
Pull Request Test Coverage Report for Build 961a2e7c-ad7e-401a-bff2-7cecf5aa4419
💛 - Coveralls |
Hey @micalevisk I've implemented the code review suggestions, but could you help me with the Role guard so i can write the e2e test to the create endpoint? |
@Yansb we would have to mock the |
@micalevisk should i change this implementation to search for the role on the body or header? |
you could propose that change in another PR after merging this one. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The sample 01 already have e2e tests and unitary tests on the controller, but it's missing tests on the service. It's also missing tests on the create cat function
Issue Number: #1539
What is the new behavior?
I've added a new test file providing an example on how to test only the service, and modified the controller test to add the create cat test.
Does this PR introduce a breaking change?
Other information
I've tried to create an e2e test to the POST method, however the Role guard is blocking the request, I've noticed that in the
src/common/guards/roles.guard.ts
the guard is expecting an property from the request calleduser
but I did not found a way to pass this property in my request, without using the header or body.