Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Last active August 29, 2016 18:24
Show Gist options
  • Select an option

  • Save KensoDev/955a0946031d00fb600e0a3e934ab752 to your computer and use it in GitHub Desktop.

Select an option

Save KensoDev/955a0946031d00fb600e0a3e934ab752 to your computer and use it in GitHub Desktop.
import * as actions from '../../actions'
import * as types from '../../constants/actionTypes'
import itemTypeReducer from './ItemTypeReducer'
describe('itemTypeReducer', () => {
it('Toggles the Hotel item into the selected array', function() {
let initialState = {
selected: []
};
let action = {
itemType: 'Hotel',
type: types.TOGGLE_ITEM_TYPE
};
let newState = itemTypeReducer(initialState, action);
expect(newState.selected[0]).to.eq("Hotel");
});
it('toggles out the Hotel if its already included', function() {
let initialState = {
selected: ['Hotel']
};
let action = {
itemType: 'Hotel',
type: types.TOGGLE_ITEM_TYPE
};
let newState = itemTypeReducer(initialState, action);
expect(newState.selected).to.have.length(0);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment