Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
adding couple more tests to confirm users model works as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Jul 24, 2015
1 parent 29d264d commit ac35f0f
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion modules/users/tests/server/user.server.model.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var should = require('should'),
/**
* Globals
*/
var user, user2;
var user, user2, user3;

/**
* Unit tests
Expand All @@ -35,6 +35,15 @@ describe('User Model Unit Tests:', function() {
password: 'password',
provider: 'local'
});
user3 = new User({
firstName: 'Different',
lastName: 'User',
displayName: 'Full Different Name',
email: '[email protected]',
username: 'different_username',
password: 'different_password',
provider: 'local'
});

done();
});
Expand Down Expand Up @@ -77,6 +86,37 @@ describe('User Model Unit Tests:', function() {
done();
});
});

it('should be able to save 2 different users', function(done) {
user.remove(function(err) {
should.not.exist(err);
user.save(function(err) {
user3.save(function(err) {
should.not.exist(err);
user3.remove(function(err) {
should.not.exist(err);
done();
});

});
});
});
});

it('should not be able to save different user with the same email address', function(done) {
user.remove(function(err) {
should.not.exist(err);
user.save(function(err) {
user3.email = user.email;
user3.save(function(err) {
should.exist(err);
done();
});
});
});

});

});

after(function(done) {
Expand Down

0 comments on commit ac35f0f

Please sign in to comment.