Skip to content

Commit

Permalink
Fix Jest spy code in documentation
Browse files Browse the repository at this point in the history
While looking into reduxjs#1944 I noticed that the examples in the documentation
still uses expect's createSpy() instead of Jest's fn() approach
  • Loading branch information
HeinrichFilter committed Sep 13, 2016
1 parent e5e608e commit ba33af7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/recipes/WritingTests.md
Expand Up @@ -304,7 +304,7 @@ import Header from '../../components/Header'

function setup() {
const props = {
addTodo: expect.createSpy()
addTodo: jest.fn(() => {})
}

const enzymeWrapper = shallow(<Header {...props} />)
Expand Down Expand Up @@ -333,9 +333,9 @@ describe('components', () => {
const { enzymeWrapper, props } = setup()
const input = enzymeWrapper.find('TodoTextInput')
input.props().onSave('')
expect(props.addTodo.calls.length).toBe(0)
expect(props.addTodo.mock.calls.length).toBe(0)
input.props().onSave('Use Redux')
expect(props.addTodo.calls.length).toBe(1)
expect(props.addTodo.mock.calls.length).toBe(1)
})
})
})
Expand Down

0 comments on commit ba33af7

Please sign in to comment.