From f900619d0d396b3ce74c7ee7678ee6c88cedf2f5 Mon Sep 17 00:00:00 2001 From: Olasunkanmi Oyinlola Date: Fri, 16 Feb 2024 08:36:53 +0800 Subject: [PATCH] fix build errors --- backend/.vscode/launch.json | 2 +- backend/src/singleclient/singleclient-service.spec.ts | 4 +++- backend/src/singleclient/singleclient.service.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/.vscode/launch.json b/backend/.vscode/launch.json index 5a68d98e..c4066caa 100644 --- a/backend/.vscode/launch.json +++ b/backend/.vscode/launch.json @@ -21,7 +21,7 @@ "request": "launch", "name": "Test", "runtimeExecutable": "npm", - "runtimeArgs": ["run", "test:unit", "src/order/order.service.spec.ts", "--inspect-brk"], + "runtimeArgs": ["run", "test:unit", "src/singleclient/singleclient-service.spec.ts", "--inspect-brk"], // "src/infrastructure/data_access/db_repositories/worker_sql_repository.spec.ts", "console": "integratedTerminal", "restart": true, diff --git a/backend/src/singleclient/singleclient-service.spec.ts b/backend/src/singleclient/singleclient-service.spec.ts index c94bb04b..07dd9cdf 100644 --- a/backend/src/singleclient/singleclient-service.spec.ts +++ b/backend/src/singleclient/singleclient-service.spec.ts @@ -44,6 +44,7 @@ describe('Test singleclient service', () => { const createSingleClientProps = { email: 'ola@tesla.com', passwordHash: '', + role: 'USER', }; validateUserStub.getUser = async (): Promise => { return singleclientMockData; @@ -60,7 +61,7 @@ describe('Test singleclient service', () => { await singleclientService.createSingleClient(createSingleClientProps); } catch (error: any) { expect(error.status).to.eq(400); - expect(error.response.error).to.eq('User with email ola@tesla.com already exists'); + expect(error.response.error).to.eq('User already exists, sign in.'); } }); @@ -68,6 +69,7 @@ describe('Test singleclient service', () => { const createSingleClientProps = { email: 'ola@ola.com', passwordHash: '', + role: 'USER', }; contextServiceStub.getContext = (): Context => { return new Context(createSingleClientProps.email, ''); diff --git a/backend/src/singleclient/singleclient.service.ts b/backend/src/singleclient/singleclient.service.ts index 23f109b6..828e2274 100644 --- a/backend/src/singleclient/singleclient.service.ts +++ b/backend/src/singleclient/singleclient.service.ts @@ -48,7 +48,7 @@ export class SingleClientService extends AuthService implements ISingleClientSer const { email } = props; const existingSingleClient: Result = await this.singleclientRepository.findOne({ email }); if (existingSingleClient.isSuccess && existingSingleClient.getValue().email === email) { - throwApplicationError(HttpStatus.BAD_REQUEST, `User already exists, please sign in.`); + throwApplicationError(HttpStatus.BAD_REQUEST, `User already exists, sign in.`); } const audit: Audit = Audit.createInsertContext(context);