Last active
October 14, 2017 07:18
-
-
Save junibrosas/f8102fd8e0b5c8a848961403abff8381 to your computer and use it in GitHub Desktop.
Compilation of snippets for testing reducers in React with Redux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IState } from './types'; | |
import { MyReducer } from './path/to/my/reducer'; | |
import { expect, assert } from 'chai'; | |
describe("DashBoardTodoListStateReducer", () => | |
{ | |
var defaultState:IState | |
beforeEach(() => { | |
defaultState = MyReducer(undefined, undefined); | |
}); | |
it("Should set List.", () => | |
{ | |
var value = []; | |
var state = MyReducer(defaultState, {type:"MyAction", Value:value}); | |
chai.assert.equal(state.List, value, "List was not set in the reducer."); | |
chai.assert.notEqual(defaultState, state, "Mutable state detected!") | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment