Ejemplo n.º 1
0
    it('Should change the state by the action payload if it\'s valid.', () => {
      let _state = seqReducer(undefined, {})
      expect(_state).to.eql(_initialState)

      _state = seqReducer(_state, changeSequence(1))
      expect(_state).to.eql(ALLOWED_SEQUENCES[1])

      // Duplicate action should do nothing
      _state = seqReducer(_state, changeSequence(1))
      expect(_state).to.eql(ALLOWED_SEQUENCES[1])

      // Invalid action should do nothing
      _state = seqReducer(_state, changeSequence('timothy'))
      expect(_state).to.eql(ALLOWED_SEQUENCES[1])
    })
Ejemplo n.º 2
0
 it('Should return the previous state if an action was not matched.', () => {
   let state = seqReducer(undefined, {})
   expect(state).to.eql(_initialState)
   state = seqReducer(state, {type: '@@@@@@@'})
   expect(state).to.eql(_initialState)
   state = seqReducer(state, changeSequence(1))
   expect(state).to.eql(ALLOWED_SEQUENCES[1])
   state = seqReducer(state, {type: '@@@@@@@'})
   expect(state).to.eql(ALLOWED_SEQUENCES[1])
 })
Ejemplo n.º 3
0
 it('Should assign argument into "payload"', () => {
   const _result = changeSequence(1)
   expect(_result).to.have.property('payload')
   expect(_result).to.have.deep.property('payload.amountOfshortBreaks', 1)
 })
Ejemplo n.º 4
0
 it('Should return an action with type "CHANGE_SEQUENCE".', () => {
   expect(changeSequence(1)).to.have.property('type', CHANGE_SEQUENCE)
 })