From fbde8ba939d88b607d465dfb1944302c18b33128 Mon Sep 17 00:00:00 2001 From: Max Weng <73797155+maxwn04@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:52:02 -0800 Subject: [PATCH 1/2] change email to lowercase in whens --- tests/auth.test.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/auth.test.ts b/tests/auth.test.ts index 9a9fb06c..cb935ab5 100644 --- a/tests/auth.test.ts +++ b/tests/auth.test.ts @@ -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 }; @@ -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 }; @@ -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 }; @@ -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 }; @@ -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 }; @@ -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 }); @@ -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() })) @@ -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 }; @@ -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()); @@ -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())) From 7473ad3a84c6726f6715e0aef6924a023231ded7 Mon Sep 17 00:00:00 2001 From: Max Weng <73797155+maxwn04@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:27:16 -0800 Subject: [PATCH 2/2] update version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42b144b6..ffa2d67f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@acmucsd/membership-portal", - "version": "3.4.1", + "version": "3.4.2", "description": "REST API for ACM UCSD's membership portal.", "main": "index.d.ts", "files": [