From 9c0283a0f7ff16c87a173d2e4b8e4b5e5d2b2395 Mon Sep 17 00:00:00 2001 From: alexeh Date: Sun, 13 Oct 2024 08:22:02 +0200 Subject: [PATCH] fix signUp bug, refactor tests --- api/src/modules/auth/authentication.service.ts | 2 +- api/test/integration/auth/create-user.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/modules/auth/authentication.service.ts b/api/src/modules/auth/authentication.service.ts index b1e1a421..a7f66173 100644 --- a/api/src/modules/auth/authentication.service.ts +++ b/api/src/modules/auth/authentication.service.ts @@ -79,7 +79,7 @@ export class AuthenticationService { async signUp(user: User, signUpDto: SignUpDto): Promise { const { oneTimePassword, newPassword } = signUpDto; - if (await this.isPasswordValid(user, oneTimePassword)) { + if (!(await this.isPasswordValid(user, oneTimePassword))) { throw new UnauthorizedException(); } user.isActive = true; diff --git a/api/test/integration/auth/create-user.spec.ts b/api/test/integration/auth/create-user.spec.ts index 7098e57a..87fabcab 100644 --- a/api/test/integration/auth/create-user.spec.ts +++ b/api/test/integration/auth/create-user.spec.ts @@ -67,7 +67,7 @@ describe('Create Users', () => { expect(response.status).toBe(HttpStatus.CONFLICT); // And the user should receive a message containing "Email already exists" expect(response.body.errors[0].title).toBe( - `Email ${testUser.email} already exists`, + `User with email ${testUser.email} already exists`, ); });