Zenika / react-workbench

Design your React component in an isolated context
MIT License
8 stars 1 forks source link

Refactor testing utility #72

Closed bpetetot closed 7 years ago

bpetetot commented 7 years ago

Move the function snapContainer of src/gui/components/props/input/input.spec.js into misc/snap, with following refactoring :

snapContainer = (props, state) => {
  // create store with given state (initialState)
  // create component with react-redux Provider
  // calls snap
}
fabienjuif commented 7 years ago

We could test mapStateToProps and mapDispatchToProps individually.

    it('should returns xxxx', () => {
      const state = {
        xxx: {
        },
        yyy: {
        },
      }

      expect(mapStateToProps(state, { id: 12 })).toMatchSnapshot()
    })