Skip to content

Instantly share code, notes, and snippets.

@cherta
Last active December 27, 2015 23:35
Show Gist options
  • Save cherta/a209876f6ec5b45f93d2 to your computer and use it in GitHub Desktop.
Save cherta/a209876f6ec5b45f93d2 to your computer and use it in GitHub Desktop.
Testing async actions on redux without following the manual - gist 1
// src/actions.js
export function addTodo (todo) {
return { type: 'ADD_TODO', todo: todo }
}
// test/actions.js
import test from 'tape'
import * as actions from '../src/actions'
test('addTodo action creator', function () {
t.plan(1)
const payload = { id: null, title: 'The title!', body: 'The post body' }
t.deepEqual(action.addTodo(payload), { type: 'ADD_TODO', todo: payload } )
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment