Skip to content

Commit d9982d4

Browse files
test(user): check for undefined email and password
1 parent 474a3a1 commit d9982d4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js

+12-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ describe('User Model', function() {
4646
return <%= expect() %>user.save()<%= to() %>.be.rejected;
4747
});
4848

49-
it('should fail when saving without an email', function() {
49+
it('should fail when saving with a null email', function() {
5050
user.email = null;
5151
return <%= expect() %>user.save()<%= to() %>.be.rejected;
52+
});
53+
54+
it('should fail when saving without an email', function() {
55+
user.email = undefined;
56+
return <%= expect() %>user.save()<%= to() %>.be.rejected;
5257
});<% if (filters.oauth && filters.googleAuth) { %>
5358

5459
context('given user provider is google', function() {
@@ -102,11 +107,16 @@ describe('User Model', function() {
102107
return <%= expect() %>user.save()<%= to() %>.be.rejected;
103108
});
104109

105-
it('should fail when saving without a password', function() {
110+
it('should fail when saving with a null password', function() {
106111
user.password = null;
107112
return <%= expect() %>user.save()<%= to() %>.be.rejected;
108113
});
109114

115+
it('should fail when saving without a password', function() {
116+
user.password = undefined;
117+
return <%= expect() %>user.save()<%= to() %>.be.rejected;
118+
});
119+
110120
context('given the user has been previously saved', function() {
111121
beforeEach(function() {
112122
return user.save();

0 commit comments

Comments
 (0)