Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. it('it should return 404 if no teams are found', done => {
  2. const route = '/v1/teams'
  3.  
  4. /*
  5. * Using Sinon to mock the response from the controller.
  6. * We want the controller decoupled from this test. We'll integrate them later.
  7. /*
  8. sandbox.stub(teams, 'getAllTeams').returns([])
  9.  
  10. chai
  11. .request(app)
  12. .get(route)
  13. .end((err, res) => {
  14. if (err) done(err)
  15.  
  16. /*
  17. * We still want to see the structure in our contract
  18. */
  19. expect(res).to.haveOwnProperty('status')
  20. expect(res).to.haveOwnProperty('body')
  21. /*
  22. * But we want a 404 response if no data is found
  23. */
  24. expect(res.status).to.equal(404)
  25.  
  26. done()
  27. })
  28. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement