Last active
September 4, 2018 11:25
-
-
Save oroce/6d0d2681dd2112a5cc84c5e1d3835966 to your computer and use it in GitHub Desktop.
Revisions
-
oroce revised this gist
Sep 4, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ export function simple(num) { return { type: 'add', payload: { @@ -7,7 +7,7 @@ function simple(num) { }; } export function withDispatch(num) { return dispatch => { dispatch({ type: 'add', -
oroce created this gist
Sep 4, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ function simple(num) { return { type: 'add', payload: { num } }; } function withDispatch(num) { return dispatch => { dispatch({ type: 'add', payload: { num, } }); }; }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import * as actions from './actions'; import sinon from 'sinon'; describe('simple', () => { it('should return add action with the num passed', () => { action.simple(4).should.eql({ type: 'add', payload: { num: 4 } }); }); }); describe('withDispatch', () => { it('should dispatch add action with the num passed', () => { const dispatch = sinon.stub(); action.withDispatch(3)(dispatch); dispatch.calledOnce.should.be.true(); dispatch.getCall(0).args[0].should.eql({ type: 'add', payload: { num: 3 } }); }); }); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ { "scripts": "mocha -r should '*.spec.js'" }