Skip to content

Instantly share code, notes, and snippets.

@brookslyrette
Created February 26, 2017 13:21
Show Gist options
  • Select an option

  • Save brookslyrette/72775f2d5d024d4603607e06202f91c0 to your computer and use it in GitHub Desktop.

Select an option

Save brookslyrette/72775f2d5d024d4603607e06202f91c0 to your computer and use it in GitHub Desktop.
import { counter } from './store.js'
describe('reducers', () => {
describe('counter', () => {
it('should provide the initial state', () => {
expect(counter(undefined, {})).toBe(0)
})
it('should handle INCREMENT action', () => {
expect(counter(1, { type: 'INCREMENT' })).toBe(2)
})
it('should handle DECREMENT action', () => {
expect(counter(1, { type: 'DECREMENT' })).toBe(0)
})
it('should handle RESET action', () => {
expect(counter(99, { type: 'RESET' })).toBe(0)
})
it('should ignore unknown actions', () => {
expect(counter(9, { type: 'unknown' })).toBe(9)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment