Routing-controllers: Samples should include a test-suite

Created on 18 Jul 2017  路  3Comments  路  Source: typestack/routing-controllers

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.

awaiting answer

Most helpful comment

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 ...

All 3 comments

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codedoge picture codedoge  路  6Comments

dcbartlett picture dcbartlett  路  3Comments

d-bechtel picture d-bechtel  路  6Comments

kkorus picture kkorus  路  4Comments

mlarsson picture mlarsson  路  5Comments