Skip to content

Commit

Permalink
Update mentor.service.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
janithlahirukariyawasam committed Jan 14, 2024
1 parent 5c80960 commit 967dbfb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/services/mentor.service.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { getAllMentors } from './mentor.service'
import { dataSource } from '../configs/dbConfig'

type MockMentorRepository = {
interface Mentor {
id: number
name: string
}

interface MockMentorRepository {
createQueryBuilder: jest.Mock
leftJoinAndSelect: jest.Mock
where: jest.Mock
andWhere: jest.Mock
getMany: jest.Mock<Promise<any[]>>
getMany: jest.Mock<Promise<Mentor[]>>
}

jest.mock('../configs/dbConfig', () => ({
Expand Down Expand Up @@ -61,7 +66,7 @@ describe('getAllMentors', () => {
})

function createMockMentorRepository(
data: any[] | undefined,
data: Mentor[] | undefined,
error?: Error
): MockMentorRepository {
return {
Expand Down

0 comments on commit 967dbfb

Please sign in to comment.