Skip to content

Commit 14641c6

Browse files
committed
fixed faulty mock auth service
1 parent c7353bd commit 14641c6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/infrastructure/services/authentication.service.mock.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { compare } from 'bcrypt-ts';
2+
13
import { IAuthenticationService } from '@/src/application/services/authentication.service.interface';
24
import { UnauthenticatedError } from '@/src/entities/errors/auth';
35
import { User } from '@/src/entities/models/user';
@@ -13,11 +15,11 @@ export class MockAuthenticationService implements IAuthenticationService {
1315
this._sessions = {};
1416
}
1517

16-
async validatePasswords(
18+
validatePasswords(
1719
inputPassword: string,
1820
usersHashedPassword: string
1921
): Promise<boolean> {
20-
return inputPassword === usersHashedPassword;
22+
return compare(inputPassword, usersHashedPassword);
2123
}
2224

2325
async validateSession(

src/infrastructure/services/authentication.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class AuthenticationService implements IAuthenticationService {
9898
() => this._lucia.invalidateSession(sessionId)
9999
);
100100

101-
const blankCookie = await this._instrumentationService.startSpan(
101+
const blankCookie = this._instrumentationService.startSpan(
102102
{ name: 'lucia.createBlankSessionCookie', op: 'function' },
103103
() => this._lucia.createBlankSessionCookie()
104104
);

0 commit comments

Comments
 (0)