it('Should increment the state by the action payload\'s "value" property.', () => { let state = counterReducer(undefined, {}) expect(state).to.equal(0) state = counterReducer(state, increment(1)) expect(state).to.equal(1) state = counterReducer(state, increment(2)) expect(state).to.equal(3) state = counterReducer(state, increment(-3)) expect(state).to.equal(0) })
it('Should return the previous state if an action was not matched.', () => { let state = counterReducer(undefined, {}) expect(state).to.equal(0) state = counterReducer(state, {type: '@@@@@@@'}) expect(state).to.equal(0) state = counterReducer(state, increment(5)) expect(state).to.equal(5) state = counterReducer(state, {type: '@@@@@@@'}) expect(state).to.equal(5) })
it('Should default the "payload" property to 1 if not provided.', () => { expect(increment()).to.have.property('payload', 1) })
it('Should assign the first argument to the "payload" property.', () => { expect(increment(5)).to.have.property('payload', 5) })
it('Should return an action with type "COUNTER_INCREMENT".', () => { expect(increment()).to.have.property('type', COUNTER_INCREMENT) })