This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding couple more tests to confirm users model works as expected
- Loading branch information
Showing
1 changed file
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ var should = require('should'), | |
/** | ||
* Globals | ||
*/ | ||
var user, user2; | ||
var user, user2, user3; | ||
|
||
/** | ||
* Unit tests | ||
|
@@ -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(); | ||
}); | ||
|
@@ -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) { | ||
|