From 30a228b3e06c8a6eeffbca86c0e76d1462a5393e Mon Sep 17 00:00:00 2001 From: Ben Drucker Date: Sun, 3 Jul 2016 15:13:59 -0700 Subject: [PATCH] Update onError hook test to only expect err argument --- tests/browser/hooks.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/browser/hooks.js b/tests/browser/hooks.js index a72638f..bbcc73b 100644 --- a/tests/browser/hooks.js +++ b/tests/browser/hooks.js @@ -3,26 +3,24 @@ const choo = require('../../') const view = require('../../html') test('hooks', function (t) { - t.plan(11) + t.plan(9) const app = choo({ - onError: function (err, state, createSend) { - t.equal(err.message, 'effect error', 'receives err') - t.equal(state.clicks, 1, 'current state: 1 clicks') - t.equal(typeof createSend, 'function', 'createSend fn') + onError: function (err) { + t.equal(err.message, 'effect error', 'onError: receives err') }, onAction: function (action, state, name, caller, createSend) { if (name === 'explodes') return - t.deepEqual(action, {foo: 'bar'}, 'action data') - t.equal(state.clicks, 0, 'current state: 0 clicks') - t.equal(name, 'click', 'action name') - t.equal(caller, '/', 'caller name') - t.equal(typeof createSend, 'function', 'createSend fn') + t.deepEqual(action, {foo: 'bar'}, 'onAction: action data') + t.equal(state.clicks, 0, 'onAction: current state: 0 clicks') + t.equal(name, 'click', 'onAction: action name') + t.equal(caller, '/', 'onAction: caller name') + t.equal(typeof createSend, 'function', 'onAction: createSend fn') }, onState: function (action, state, prev, createSend) { - t.deepEqual(action, {foo: 'bar'}, 'action data') - t.deepEqual(state.clicks, 1, 'new state: 1 clicks') - t.deepEqual(prev.clicks, 0, 'prev state: 0 clicks') + t.deepEqual(action, {foo: 'bar'}, 'onState: action data') + t.deepEqual(state.clicks, 1, 'onState: new state: 1 clicks') + t.deepEqual(prev.clicks, 0, 'onState: prev state: 0 clicks') } })