title: Unit testing vs Integration testing of an Express.js app
body: <p>I'm writing tests for an Express.js app and I don't know how to choose between unit tests and integration tests.</p>
  
  <p>currently I experimented with:</p>
  
  <p>unit tests - using Sinon for stubs/mocks/spies and Injects for dependency injection to modules. with this approach I have to stub MongoDB and other external methods.</p>
  
  <p>I thought about unit testing the individual routes and then using an integration test to verify that the correct routes are actually invoked.</p>
  
  <p>integration tests - using Supertest and Superagent, much less code to write (no need to mock/stub anything) but  a test environment should exist (databases, etc..)</p>
  
  <p>I'm using Mocha to run both styles of tests.</p>
  
  <p>how should I choose between those two different approaches ?</p>