mockra

Testing with ExpressJS - 29 Dec 2014


Testing with ExpressJS can be a bit tricky if you’re coming from a Rails background, but it’s much easier than you might expect.

Here’s an example controller test:

The important things to notice are that we’re using supertest to test our API, which provides us with a way to test our API. We’re also calling done() once each of our specs are finished.

You can view the complete setup here.