Created
January 7, 2016 18:44
-
-
Save matthewlehner/5aa8dcfe6a0fe00403af to your computer and use it in GitHub Desktop.
Writing tests for redux reducers
This file contains hidden or 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 { expect } from "chai"; | |
import reducer from "../../src/reducers/workspace"; | |
import { EDIT_ITEM } from "../../src/actions/workspace"; | |
describe("workspace reducer", () => { | |
it("handles EDIT_ITEM", () => { | |
const initialState = {}; | |
const action = { | |
type: EDIT_ITEM, | |
itemIndex: 1 | |
}; | |
const nextState = reducer(initialState, action); | |
expect(nextState.editingItem).to.equal(1); | |
expect(nextState.isEditing).to.equal(true); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment