Skip to content

Instantly share code, notes, and snippets.

@tb
Created March 3, 2017 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tb/41450c6f423c943fef267eb1660ad893 to your computer and use it in GitHub Desktop.
Save tb/41450c6f423c943fef267eb1660ad893 to your computer and use it in GitHub Desktop.
describe('clear button', () => {
test('no clear button when no completed todos', () => {
const { clear } = setup({ completedCount: 0 })
expect(clear.exists()).toBe(false)
})
test('on click calls onClearCompleted', () => {
const { clear, props } = setup({ completedCount: 1 })
expect(clear.text()).toEqual('Clear completed')
clear.simulate('click')
expect(props.onClearCompleted).toBeCalledWith()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment