typestack / routing-controllers

Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage in Express / Koa using TypeScript and Routing Controllers Framework.
MIT License
4.41k stars 394 forks source link

Samples should include a test-suite #218

Open OysteinAmundsen opened 7 years ago

OysteinAmundsen commented 7 years ago

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.

MichalLytek commented 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 😉

gjdass commented 7 years ago

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

github-actions[bot] commented 4 years ago

Stale issue message

matte0080 commented 1 year ago

Any news?