Skip to content

Commit

Permalink
refactor: fix failing prettier lint in profile.controller.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
naftalimurgor committed Dec 6, 2023
1 parent 602f786 commit d223029
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions apps/api/src/user/profile.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ describe('Profile Controller', () => {
let profileController: ProfileController
let mockedUserService: jest.Mocked<UserService>


const testUserProfile = {
firstName: 'John',
lastName: 'Doe'
Expand All @@ -22,14 +21,17 @@ describe('Profile Controller', () => {
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ProfileController]
}).useMocker((token: InjectionToken) => {
if (token === UserService) {
return {
findOne: jest.fn().mockImplementation(() => testUserProfile),
update: jest.fn().mockImplementation((testId: number, args: {}) => { return { args } })
}
}
})
.useMocker((token: InjectionToken) => {
if (token === UserService) {
return {
findOne: jest.fn().mockImplementation(() => testUserProfile),
update: jest.fn().mockImplementation((testId: number, args: {}) => {
return { args }
})
}
}
})
.compile()

profileController = module.get<ProfileController>(ProfileController)
Expand Down Expand Up @@ -59,7 +61,10 @@ describe('Profile Controller', () => {
lastName: 'Doe'
}
const testUserId = 2
const updateProfile = await profileController.update(testUserId, updatesUser)
await expect(updateProfile).resolves.toBeDefined()
const updateProfile = await profileController.update(
testUserId,
updatesUser
)
expect(updateProfile).toBeDefined()
})
})

0 comments on commit d223029

Please sign in to comment.