-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 🧪 update mock data in test cases
- Loading branch information
1 parent
b66a109
commit 330dca5
Showing
2 changed files
with
13 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,12 @@ describe('GetUserUseCase', () => { | |
|
||
describe('execute', () => { | ||
it('should return user when found', async () => { | ||
const mockUser = { id: '1', name: 'John Doe' }; | ||
const mockUser = { | ||
id: '1', | ||
email: '[email protected]', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}; | ||
(usersRepository.findById as jest.Mock).mockResolvedValue(mockUser); | ||
|
||
const result = await getUserUseCase.execute('1'); | ||
|
@@ -32,4 +37,4 @@ describe('GetUserUseCase', () => { | |
expect(usersRepository.findById).toHaveBeenCalledWith('1'); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,12 @@ describe('UsersService', () => { | |
|
||
describe('findById', () => { | ||
it('should return a user if found', async () => { | ||
const user: User = { id: '1', name: 'John Doe' }; | ||
const user: User = { | ||
id: '1', | ||
email: '[email protected]', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}; | ||
jest.spyOn(getUserUseCase, 'execute').mockResolvedValue(user); | ||
|
||
const result = await service.findById('1'); | ||
|