Skip to content

Instantly share code, notes, and snippets.

@tb

tb/setup.spec.js Secret

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/ac9e7f2ecbd6830bd2c6f1234076f9ae to your computer and use it in GitHub Desktop.
Save tb/ac9e7f2ecbd6830bd2c6f1234076f9ae to your computer and use it in GitHub Desktop.
const setup = propOverrides => {
const props = Object.assign({
completedCount: 0,
activeCount: 0,
onClearCompleted: jest.fn(),
}, propOverrides)
const wrapper = shallow(<Footer {...props} />)
return {
props,
wrapper,
clear: wrapper.find('.clear-completed'),
count: wrapper.find('.todo-count'),
}
}
describe('count', () => {
test('when active count 0', () => {
const { count } = setup({ activeCount: 0 })
expect(count.text()).toEqual('No items left')
})
test('when active count above 0', () => {
const { count } = setup({ activeCount: 1 })
expect(count.text()).toEqual('1 item left')
})
});
@Bartuz
Copy link

Bartuz commented Jul 3, 2018

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment