counter.spec.js 697 B

1234567891011121314151617181920
  1. import jsc from 'jsverify'
  2. import React from 'react'
  3. import configStore from 'redux-mock-store'
  4. import ConnectedCounter, {Counter} from '../src/counter'
  5. describe('Counter', () => {
  6. const createStore = configStore()
  7. const wrapper = store => mount(<ConnectedCounter store={store}/>)
  8. it('Displays count from redux', () =>
  9. jsc.checkForall(jsc.nat, count =>
  10. expect(wrapper(createStore({count})).find(Counter).prop('count'))
  11. .equal(count))),
  12. it('Calls increment action when clicked', () => {
  13. const store = createStore({count: 0})
  14. wrapper(store).find(Counter).find('button').simulate('click')
  15. expect(store.getActions()[0].type)
  16. .equal("INCREMENT")
  17. })
  18. })