Open OysteinAmundsen opened 7 years ago
@OysteinAmundsen is this your first node.js/express project?
I haven't thought about this as it's even simplier that testing pure express app - you don't have to mock req and res, you just test controller methods like a normal method from services, etc. Just passing inputs params and asserting outputs. With DI you can easily pass mocked service in controller constructor so you don't have to mock and stub the whole world.
I will accept PRs with good samples 😉
Hi.
I'm currently building some simple UTs (with Container injection of mocks etc) cause I'm lacking of those. Maybe I can try to post a PR here once I'm done with that on my project. It will be simple but it's a start ...
Stale issue message
Any news?
The samples should include a test-runner and unit tests for each controller, demonstrating how one would implement unit testing. I know there are a lot of test frameworks out there, but choose one and a lot of details for all others would fall into place.
This would be a great starting-point for people (like me) who struggles with how to setup i.e. a karma runner for a nodejs typescript project like this.