diff --git a/api/src/modules/auth/authentication/authentication.controller.ts b/api/src/modules/auth/authentication/authentication.controller.ts index 0067e5e2..eeb014fd 100644 --- a/api/src/modules/auth/authentication/authentication.controller.ts +++ b/api/src/modules/auth/authentication/authentication.controller.ts @@ -40,7 +40,7 @@ export class AuthenticationController { // TODO: Wrap this in a ts-rest handler @Public() - @Post('recover-password') + @Post('authentication/recover-password') async recoverPassword( @Headers('origin') origin: string, @Body() body: { email: string }, diff --git a/api/test/e2e/features/sign-up.feature b/api/test/e2e/features/sign-up.feature deleted file mode 100644 index 6743e93d..00000000 --- a/api/test/e2e/features/sign-up.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: User Sign Up - - Scenario: A user cannot sign up with an already registered email - Given a user exists with valid credentials - When the user attempts to sign up with the same email - Then the user should receive a 409 status code - And the response message should be "Email already exists" - - Scenario: A user successfully signs up with a new email - When a user attempts to sign up with valid credentials - Then the user should be registered successfully - And the user should have a valid ID and email diff --git a/api/test/e2e/steps/sign-up.steps.ts b/api/test/e2e/steps/sign-up.steps.ts deleted file mode 100644 index b125d7ce..00000000 --- a/api/test/e2e/steps/sign-up.steps.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { defineFeature, loadFeature } from 'jest-cucumber'; -import { Response } from 'supertest'; -import { User } from '@shared/entities/users/user.entity'; -import { TestManager } from 'api/test/utils/test-manager'; - -const feature = loadFeature('./test/e2e/features/sign-up.feature'); - -defineFeature(feature, (test) => { - let testManager: TestManager; - - beforeAll(async () => { - testManager = await TestManager.createTestManager(); - }); - - beforeEach(async () => { - await testManager.clearDatabase(); - }); - - afterAll(async () => { - await testManager.close(); - }); - - test('A user cannot sign up with an already registered email', ({ - given, - when, - then, - and, - }) => { - let existingUser: User; - let response: Response; - - given('a user exists with valid credentials', async () => { - existingUser = await testManager.mocks().createUser({ - email: 'existing@test.com', - password: 'password123', - }); - }); - - when('the user attempts to sign up with the same email', async () => { - response = await testManager - .request() - .post('/authentication/signup') - .send({ email: existingUser.email, password: 'password123' }); - }); - - then( - /the user should receive a (\d+) status code/, - async (statusCode: string) => { - expect(response.status).toBe(Number.parseInt(statusCode)); - }, - ); - - and('the response message should be "Email already exists"', async () => { - expect(response.body.message).toEqual( - `Email ${existingUser.email} already exists`, - ); - }); - }); - - test('A user successfully signs up with a new email', ({ - when, - then, - and, - }) => { - let newUser: { email: string; password: string }; - let createdUser: User; - let response: Response; - - when('a user attempts to sign up with valid credentials', async () => { - newUser = { email: 'newuser@test.com', password: '12345678' }; - response = await testManager - .request() - .post('/authentication/signup') - .send({ - email: newUser.email, - password: newUser.password, - }); - }); - - then('the user should be registered successfully', async () => { - expect(response.status).toBe(201); - }); - - and('the user should have a valid ID and email', async () => { - createdUser = await testManager - .getDataSource() - .getRepository(User) - .findOne({ where: { email: newUser.email } }); - - expect(createdUser.id).toBeDefined(); - expect(createdUser.email).toEqual(newUser.email); - }); - }); -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef89753e..da8c5325 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,15 +12,9 @@ catalogs: class-transformer: specifier: 0.5.1 version: 0.5.1 - pg: - specifier: 8.12.0 - version: 8.12.0 typeorm: specifier: 0.3.20 version: 0.3.20 - zod: - specifier: 3.23.8 - version: 3.23.8 importers: @@ -6114,7 +6108,7 @@ snapshots: '@typescript-eslint/type-utils': 7.2.0(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/visitor-keys': 7.2.0 - debug: 4.3.6 + debug: 4.3.6(supports-color@8.1.1) eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.2 @@ -6145,7 +6139,7 @@ snapshots: '@typescript-eslint/types': 7.2.0 '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.5.4) '@typescript-eslint/visitor-keys': 7.2.0 - debug: 4.3.6 + debug: 4.3.6(supports-color@8.1.1) eslint: 8.57.0 optionalDependencies: typescript: 5.5.4 @@ -6178,7 +6172,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.5.4) '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.5.4) - debug: 4.3.6 + debug: 4.3.6(supports-color@8.1.1) eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -6209,7 +6203,7 @@ snapshots: dependencies: '@typescript-eslint/types': 7.2.0 '@typescript-eslint/visitor-keys': 7.2.0 - debug: 4.3.6 + debug: 4.3.6(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -6907,6 +6901,12 @@ snapshots: dependencies: ms: 2.1.2 + debug@4.3.6(supports-color@8.1.1): + dependencies: + ms: 2.1.2 + optionalDependencies: + supports-color: 8.1.1 + dedent@1.5.3: {} deep-equal@2.2.3: @@ -7173,7 +7173,7 @@ snapshots: eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0): dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.3.6 + debug: 4.3.6(supports-color@8.1.1) enhanced-resolve: 5.17.1 eslint: 8.57.0 eslint-module-utils: 2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0)