Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lowercase emails to when in registration test #408

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tests/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('account registration', () => {

// register member
const emailService = mock(EmailService);
when(emailService.sendEmailVerification(user.email, user.firstName, anyString()))
when(emailService.sendEmailVerification(user.email.toLowerCase(), user.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const registerRequest = { user };
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('account registration', () => {
});

const emailService = mock(EmailService);
when(emailService.sendEmailVerification(user.email, user.firstName, anyString()))
when(emailService.sendEmailVerification(user.email.toLowerCase(), user.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const registerRequest = { user };
Expand All @@ -113,7 +113,7 @@ describe('account registration', () => {
});

const emailService = mock(EmailService);
when(emailService.sendEmailVerification(user.email, user.firstName, anyString()))
when(emailService.sendEmailVerification(user.email.toLowerCase(), user.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const registerRequest = { user };
Expand All @@ -140,7 +140,7 @@ describe('account registration', () => {

// register member
const emailService = mock(EmailService);
when(emailService.sendEmailVerification(user.email, user.firstName, anyString()))
when(emailService.sendEmailVerification(user.email.toLowerCase(), user.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const registerRequest = { user };
Expand All @@ -163,7 +163,7 @@ describe('account registration', () => {

// register member
const emailService = mock(EmailService);
when(emailService.sendEmailVerification(user.email, user.firstName, anyString()))
when(emailService.sendEmailVerification(user.email.toLowerCase(), user.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const registerRequest = { user };
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('verifying email', () => {
.write();

const emailService = mock(EmailService);
when(emailService.sendEmailVerification(member.email, member.firstName, anyString()))
when(emailService.sendEmailVerification(member.email.toLowerCase(), member.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
await authController.verifyEmail({ accessCode });
Expand All @@ -305,7 +305,7 @@ describe('verifying email', () => {
.write();

const emailService = mock(EmailService);
when(emailService.sendEmailVerification(member.email, member.firstName, anyString()))
when(emailService.sendEmailVerification(member.email.toLowerCase(), member.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
await expect(authController.verifyEmail({ accessCode: FactoryUtils.randomHexString() }))
Expand All @@ -326,7 +326,7 @@ describe('resending email verification', () => {
.write();

const emailService = mock(EmailService);
when(emailService.sendEmailVerification(member.email, member.firstName, anyString()))
when(emailService.sendEmailVerification(member.email.toLowerCase(), member.firstName, anyString()))
.thenResolve();
const authController = ControllerFactory.auth(conn, instance(emailService));
const params = { email: member.email };
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('resending password reset email', () => {
.write();

const emailService = mock(EmailService);
when(emailService.sendPasswordReset(member.email, member.firstName, anyString()));
when(emailService.sendPasswordReset(member.email.toLowerCase(), member.firstName, anyString()));
const authController = ControllerFactory.auth(conn, instance(emailService));
const params = { email: member.email };
await authController.sendPasswordResetEmail(params, FactoryUtils.randomHexString());
Expand All @@ -495,7 +495,7 @@ describe('resending password reset email', () => {
const member = UserFactory.fake();

const emailService = mock(EmailService);
when(emailService.sendPasswordReset(member.email, member.firstName, anyString()));
when(emailService.sendPasswordReset(member.email.toLowerCase(), member.firstName, anyString()));
const authController = ControllerFactory.auth(conn, instance(emailService));
const params = { email: member.email };
await expect(authController.sendPasswordResetEmail(params, FactoryUtils.randomHexString()))
Expand Down
Loading