Skip to content

Commit

Permalink
Update auth.service.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
janithlahirukariyawasam committed Jan 16, 2024
1 parent 611ad46 commit 8463bb2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/services/auth.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { registerUser, loginUser } from './auth.service'
import { dataSource } from '../configs/dbConfig'

jest.mock('bcrypt', () => ({
hash: jest.fn((password) => Promise.resolve(`hashed_${password}`)),
compare: jest.fn((password, hashedPassword) =>
Promise.resolve(password === hashedPassword)
hash: jest.fn(
async (password) => await Promise.resolve(`hashed_${password}`)

Check failure on line 6 in src/services/auth.service.test.ts

View workflow job for this annotation

GitHub Actions / build

Invalid type "any" of template literal expression
),
compare: jest.fn(
async (password, hashedPassword) =>
await Promise.resolve(password === hashedPassword)
)
}))

Expand All @@ -23,7 +26,7 @@ describe('registerUser', () => {
const mockProfileRepository = {
findOne: jest.fn().mockResolvedValue(null),
create: jest.fn((data) => data),
save: jest.fn((profile) => Promise.resolve(profile))
save: jest.fn(async (profile) => await Promise.resolve(profile))
}

;(dataSource.getRepository as jest.Mock).mockReturnValueOnce(
Expand Down

0 comments on commit 8463bb2

Please sign in to comment.