Skip to content

Commit

Permalink
Correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hagopj13 committed Mar 30, 2021
1 parent 97b921d commit 412f3fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/models/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const userSchema = mongoose.Schema(
enum: roles,
default: 'user',
},
isEmailVarified: {
isEmailVerified: {
type: Boolean,
default: false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/services/auth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const verifyEmail = async (emailVarificationToken) => {
throw new Error();
}
await Token.deleteMany({ user: user.id, type: tokenTypes.VERIFY_EMAIL });
await userService.updateUserById(user.id, { isEmailVarified: true });
await userService.updateUserById(user.id, { isEmailVerified: true });
} catch (error) {
throw new ApiError(httpStatus.UNAUTHORIZED, 'email verification failed');
}
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe('Auth routes', () => {
name: newUser.name,
email: newUser.email,
role: 'user',
isEmailVarified: false,
isEmailVerified: false,
});

const dbUser = await User.findById(res.body.user.id);
expect(dbUser).toBeDefined();
expect(dbUser.password).not.toBe(newUser.password);
expect(dbUser).toMatchObject({ name: newUser.name, email: newUser.email, role: 'user', isEmailVarified: false });
expect(dbUser).toMatchObject({ name: newUser.name, email: newUser.email, role: 'user', isEmailVerified: false });

expect(res.body.tokens).toEqual({
access: { token: expect.anything(), expires: expect.anything() },
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('Auth routes', () => {
name: userOne.name,
email: userOne.email,
role: userOne.role,
isEmailVarified: false,
isEmailVerified: false,
});

expect(res.body.tokens).toEqual({
Expand Down Expand Up @@ -419,7 +419,7 @@ describe('Auth routes', () => {

const dbUser = await User.findById(userOne._id);

expect(dbUser.isEmailVarified).toBe(true);
expect(dbUser.isEmailVerified).toBe(true);

const dbVerificationEmailTokenCount = await Token.countDocuments({
user: userOne._id,
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ describe('User routes', () => {
name: newUser.name,
email: newUser.email,
role: newUser.role,
isEmailVarified: false,
isEmailVerified: false,
});

const dbUser = await User.findById(res.body.id);
expect(dbUser).toBeDefined();
expect(dbUser.password).not.toBe(newUser.password);
expect(dbUser).toMatchObject({ name: newUser.name, email: newUser.email, role: newUser.role, isEmailVarified: false });
expect(dbUser).toMatchObject({ name: newUser.name, email: newUser.email, role: newUser.role, isEmailVerified: false });
});

test('should be able to create an admin as well', async () => {
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('User routes', () => {
name: userOne.name,
email: userOne.email,
role: userOne.role,
isEmailVarified: false,
isEmailVerified: false,
});
});

Expand Down Expand Up @@ -366,7 +366,7 @@ describe('User routes', () => {
email: userOne.email,
name: userOne.name,
role: userOne.role,
isEmailVarified: false,
isEmailVerified: false,
});
});

Expand Down Expand Up @@ -499,7 +499,7 @@ describe('User routes', () => {
name: updateBody.name,
email: updateBody.email,
role: 'user',
isEmailVarified: false,
isEmailVerified: false,
});

const dbUser = await User.findById(userOne._id);
Expand Down

0 comments on commit 412f3fe

Please sign in to comment.