Skip to content

Instantly share code, notes, and snippets.

@skellock
Created June 27, 2016 12:55
Show Gist options
  • Save skellock/e55bed3b1716d35ccf6fef386ddb2676 to your computer and use it in GitHub Desktop.
Save skellock/e55bed3b1716d35ccf6fef386ddb2676 to your computer and use it in GitHub Desktop.
import test from 'ava'
import reducer from './CounterReducer'
test('increment from a fresh state', t => {
const state = reducer(undefined, { type: 'INCREMENT' })
t.deepEqual(state, { value: 1 })
})
test('increment from a previous state', t => {
const state = reducer({ value: 68 }, { type: 'INCREMENT' })
t.deepEqual(state, { value: 69 })
})
test('play nicely with other reducers', t => {
const previousState = { value: 9000 }
const state = reducer(previousState, { type: 'NONE' })
t.is(state, previousState)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment