Skip to content

Instantly share code, notes, and snippets.

@colwem
Created March 30, 2016 05:52
Show Gist options
  • Save colwem/40c9af1054d11c402599b8c0937785fd to your computer and use it in GitHub Desktop.
Save colwem/40c9af1054d11c402599b8c0937785fd to your computer and use it in GitHub Desktop.
it('returns errors for both username and password when submitting empty user object', function (done) {
var user = User.forge({});
var errors;
user.register()
.then((function (res) {
console.log('supposed to be rejected', res);
}))
.catch(function (err) {
errors = err;
console.log('errors', err);
should.exist(errors.errors.email.errors[0].rule);
errors.errors.email.errors[0].rule.should.equal('required');
should.exist(errors.errors.password.errors[0].rule);
errors.errors.password.errors[0].rule.should.equal('required');
})
.then(() => done(), done);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment