Closed vitorgamer58 closed 2 years ago
Locally, adding this line in the function run of the UseCase class made my code work, but when doing this in the repository and running the buchu tests, many of tests failed.
Solved, It's my fault.
Need to call await useCaseName.authorize();
Before than await useCaseName.run()
Describe the bug In my UseCase I defined the following authorization code:
authorize: () => Ok(true),
But the usecase returned with a error:Err { _error: 'Not Authorized' }
Which doesn't make any logical sense, since my authorization doesn't return an error, and it should always return Ok()To Reproduce Steps to reproduce the behavior:
Create a UseCase and put a normal Authorize, and then request through the Rest API the endpoint that calls this UseCase. A curiosity about this bug is that it only happens through the Rest API call, and does not happen in unit tests.
Expected behavior The expected behavior is that it should go through the authorize de and proceed with the usecase steps, which didn't happen in my case.
Screenshots
Additional context I'm using the latest version of Herbsjs, I can provide the code in zip with the error happening.