Skip to content

Commit

Permalink
test:getAllUsers Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshay saini committed Dec 29, 2023
1 parent b0228d0 commit cb84237
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/api/src/user/user.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,18 @@ describe('UserController', () => {
expect(await controller.getUserById(userId)).toEqual(null)
})
})

describe('should get all users', () => {
it('should return all users with default parameters', async () => {
jest.spyOn(service, 'getAllUsers').mockResolvedValue([user])
expect(await controller.getAllUsers()).toEqual([user])
})

it('should return all users with custom parameters', async () => {
jest.spyOn(service, 'getAllUsers').mockResolvedValue([user])
expect(await controller.getAllUsers(1, 10, 'name', 'asc', '')).toEqual([
user
])
})
})
})

0 comments on commit cb84237

Please sign in to comment.