"use strict";
var chai_1 = require('chai');
var counter = require('./counter');
/** Module */
describe('Counter Module', function () {
/** Actions */
describe('Actions', function () {
describe('Increment', function () {
it('has the correct type', function () {
var action = counter.increment();
chai_1.expect(action.type).to.equal(counter.INCREMENT);
});
});
describe('Decrement', function () {
it('has the correct type', function () {
var action = counter.decrement();
chai_1.expect(action.type).to.equal(counter.DECREMENT);
});
});
});
/** Reducer */
describe('Reducer', function () {
var state = { count: 10 };
it('handles action of type INCREMENT', function () {
var action = { type: counter.INCREMENT };
chai_1.expect(counter.counterReducer(state, action)).to.be.eql({ count: state.count + 1 });
});
it('handles action of type DECREMENT', function () {
var action = { type: counter.DECREMENT };
chai_1.expect(counter.counterReducer(state, action)).to.be.eql({ count: state.count - 1 });
});
it('handles actions with unknown type', function () {
chai_1.expect(counter.counterReducer(state, { type: '' })).to.be.eql({ count: state.count });
});
});
});
|