Skip to content

Commit 2cae517

Browse files
docs(automock): update code example to match api
1 parent d20482d commit 2cae517

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

content/recipes/automock.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ describe('CatsService unit spec', () => {
7171
beforeAll(() => {
7272
const { unit, unitRef } = TestBed.create(CatsService)
7373
.mock(HttpService)
74+
.use({ get: jest.fn() })
75+
.mock(Logger)
76+
.use({ log: jest.fn() })
77+
.mock(CatsDal)
78+
.use({ saveCats: jest.fn() })
7479
.compile();
7580

7681
underTest = unit;
@@ -82,7 +87,7 @@ describe('CatsService unit spec', () => {
8287

8388
describe('when getting all the cats', () => {
8489
test('then meet some expectations', async () => {
85-
httpService.mockResolvedValueOnce([{ id: 1, name: 'Catty' }]);
90+
httpService.get.mockResolvedValueOnce([{ id: 1, name: 'Catty' }]);
8691
await catsService.getAllCats();
8792

8893
expect(logger.log).toBeCalled();

0 commit comments

Comments
 (0)