andreluizreis
4/28/2017 - 7:51 PM

Test with Promises Link: http://tobyho.com/2015/12/16/mocha-with-promises/

it('sets settings', function() {
  return agent.post('/settings')
    .send({
      notifications: false
    })
    .expect(200)
    .then(function(resp) {
      expect(resp.body.success).to.equal(true);
      return User.findById(user.id);
    })
    .then(function(user) {
      expect(user.notifications).to.equal(false);
    });
});