Add a test case for credentials/challenges

This commit is contained in:
Raymond Feng 2014-07-15 08:20:47 -07:00
parent 22e929e439
commit 76b6dc10d9
1 changed files with 16 additions and 0 deletions

View File

@ -53,6 +53,22 @@ describe('User', function(){
});
});
it('credentials/challenges are object types', function (done) {
User.create({email: 'f1@b.com', password: 'bar1',
credentials: {cert: 'xxxxx', key: '111'},
challenges: {x: 'X', a: 1}
}, function (err, user) {
assert(!err);
User.findById(user.id, function (err, user) {
assert(user.id);
assert(user.email);
assert.deepEqual(user.credentials, {cert: 'xxxxx', key: '111'});
assert.deepEqual(user.challenges, {x: 'X', a: 1});
done();
});
});
});
it('Email is required', function (done) {
User.create({password: '123'}, function (err) {
assert(err);