all files / src/__tests__/ reducer.submitFailed.spec.js

100% Statements 19/19
100% Branches 4/4
100% Functions 5/5
100% Lines 8/8
6 statements, 1 function, 3 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                               
import {submitFailed} from '../actions'
 
const describeSubmitFailed = (reducer, expect, {fromJS}) => () => {
  it('should set submitFailed flag on submitFailed', () => {
    const state = reducer(fromJS({
      foo: {
        doesnt: 'matter',
        should: 'notchange'
      }
    }), {
      ...submitFailed(),
      form: 'foo'
    })
    expect(state)
      .toEqualMap({
        foo: {
          doesnt: 'matter',
          should: 'notchange',
          submitFailed: true
        }
      })
  })
 
  it('should clear submitting flag on submitFailed', () => {
    const state = reducer(fromJS({
      foo: {
        doesnt: 'matter',
        should: 'notchange',
        submitting: true
      }
    }), {
      ...submitFailed(),
      form: 'foo'
    })
    expect(state)
      .toEqualMap({
        foo: {
          doesnt: 'matter',
          should: 'notchange',
          submitFailed: true
        }
      })
  })
}
 
export default describeSubmitFailed