Skip to content

Instantly share code, notes, and snippets.

@dapperAuteur
Created October 25, 2016 02:50
Show Gist options
  • Save dapperAuteur/6bcc5fb54cb2f7cfba23ddcfefed7f0c to your computer and use it in GitHub Desktop.
Save dapperAuteur/6bcc5fb54cb2f7cfba23ddcfefed7f0c to your computer and use it in GitHub Desktop.
import { Map } from 'immutable';
import { expect } from 'chai';
import reducer from '../app/reducer';
describe('reducer', () => {
describe("SETUP_GAME", () => {
const action = {
type: 'SETUP_GAME'
};
describe("with empty initial state", () => {
//const initialState = undefined;
const initialState = new Map({'awayTeam': 0, 'homeTeam': 0, 'balls': 0, 'strikes': 0, 'fouls': 0, 'outs': 0, 'inning': 1})
const nextState = reducer(initialState, action);
it('sets up game', () => {
expect(nextState.get('awayTeam')).to.eq(0);
expect(nextState.get('homeTeam')).to.eq(0);
expect(nextState.get('balls')).to.eq(0);
expect(nextState.get('strikes')).to.eq(0);
expect(nextState.get('fouls')).to.eq(0);
expect(nextState.get('outs')).to.eq(0);
expect(nextState.get('inning')).to.eq(1);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment