Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Olasunkanmi Oyinlola authored and olasunkanmi-SE committed Feb 16, 2024
1 parent 18179d3 commit a07aaad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion backend/src/singleclient/singleclient-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('Test singleclient service', () => {
const createSingleClientProps = {
email: 'ola@tesla.com',
passwordHash: '',
role: 'USER',
};
validateUserStub.getUser = async (): Promise<any> => {
return singleclientMockData;
Expand All @@ -60,14 +61,15 @@ 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.');
}
});

it('Should create a SingleClient', async () => {
const createSingleClientProps = {
email: 'ola@ola.com',
passwordHash: '',
role: 'USER',
};
contextServiceStub.getContext = (): Context => {
return new Context(createSingleClientProps.email, '');
Expand Down
2 changes: 1 addition & 1 deletion backend/src/singleclient/singleclient.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class SingleClientService extends AuthService implements ISingleClientSer
const { email } = props;
const existingSingleClient: Result<SingleClient> = 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);
Expand Down

0 comments on commit a07aaad

Please sign in to comment.