Skip to content

Instantly share code, notes, and snippets.

@nickbalestra
Last active January 5, 2017 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickbalestra/de7915cf453e0a13467cf35ec66e9745 to your computer and use it in GitHub Desktop.
Save nickbalestra/de7915cf453e0a13467cf35ec66e9745 to your computer and use it in GitHub Desktop.
import reducer, { types, actions, cycle } from './user'
describe('actions', () => {
// snapshot tests
it('should export specific action types', () => {
expect(types).toMatchSnapshot()
})
it('should export specific action creators', () => {
expect(actions).toMatchSnapshot()
})
// unit tests
it('should create an action to set the email', () => {
const email = 'john@doe.com'
const expectedAction = {
type: types.SET_EMAIL,
payload: email
}
expect(actions.setEmail(email)).toEqual(expectedAction)
})
it('should create an action to set the password', () => {
const password = '1234'
const expectedAction = {
type: types.SET_PASSWORD,
payload: password
}
expect(actions.setPassword(password)).toEqual(expectedAction)
})
})
describe('reducer', () => {
// test the reducer as per :
// https://github.com/reactjs/redux/blob/master/docs/recipes/WritingTests.md
})
describe('cycle', () => {
// test I/O of the exported cycle
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment