Last active
December 27, 2015 23:35
-
-
Save cherta/a209876f6ec5b45f93d2 to your computer and use it in GitHub Desktop.
Testing async actions on redux without following the manual - gist 1
This file contains 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/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