Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created August 29, 2016 19:07
Show Gist options
  • Select an option

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

Select an option

Save KensoDev/c878c9284c5977aec4e8cd3ff04238d4 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