Last active
July 27, 2017 14:30
-
-
Save sandwichsudo/1ae272b85c12c91c721df73f29fbcbd3 to your computer and use it in GitHub Desktop.
Add test to update error in state.
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
// src/containers/RepoSearchPage/reducer/RepoSearchReducer.spec.js | |
import RepoSearchReducer from './RepoSearchReducer'; | |
import { actionTypes } from '../RepoSearchConstants'; | |
const initialState = { | |
results: [], | |
error: '', | |
}; | |
describe('RepoSearchReducer', () => { | |
describe('UPDATE_RESULTS', () => { | |
it('should update the results', () => { | |
const newState = RepoSearchReducer(initialState, { type: actionTypes.UPDATE_RESULTS, items: ['foo'] }); | |
expect(newState.results).toEqual(['foo']); | |
}); | |
}); | |
describe('REQUEST_COMPLETE', () => { | |
it('should update the error', () => { | |
const newState = RepoSearchReducer(initialState, { type: actionTypes.REQUEST_COMPLETE, error: 'foo' }); | |
expect(newState.error).toEqual('foo'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment