From a8966c4a4fa03ba717ddf09c8b8cd6a19d97dfe3 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 3 Aug 2017 22:02:31 -0400 Subject: fix test --- test/unit/actions/tx_test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/unit') diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index 0ea1bfdc7..4561082fd 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -45,11 +45,16 @@ describe('tx confirmation screen', function () { before(function (done) { actions._setBackgroundConnection({ approveTransaction (txId, cb) { cb('An error!') }, - cancelTransaction (txId) { /* noop */ }, + cancelTransaction (txId, cb) { cb() }, clearSeedWordCache (cb) { cb() }, }) + // var dispatchExpect = sinon.mock() + // dispatchExpect.once() - const action = actions.cancelTx({value: firstTxId}) + let action + actions.cancelTx({value: firstTxId})((dispatchAction) => { + action = dispatchAction + }) result = reducers(initialState, action) done() }) -- cgit v1.2.3 From b955b5a89a9ed7fd74cfec84cbf4b3623e4661e4 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 3 Aug 2017 22:10:33 -0400 Subject: add test for no callback error --- test/unit/nodeify-test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/unit') diff --git a/test/unit/nodeify-test.js b/test/unit/nodeify-test.js index 06241334d..f4fe320ca 100644 --- a/test/unit/nodeify-test.js +++ b/test/unit/nodeify-test.js @@ -17,4 +17,15 @@ describe('nodeify', function () { done() }) }) + + it('should throw if the last argument is not a function', function (done) { + var nodified = nodeify(obj.promiseFunc, obj) + try { + nodified('baz') + done(new Error('should have thrown if the last argument is not a function')) + } catch (err) { + if (err.message === 'callback is not a function') done() + else done(err) + } + }) }) -- cgit v1.2.3 From 500e7d1f04e72558fa8eb4aee60c24e5d7b71a94 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 3 Aug 2017 20:52:09 -0700 Subject: nodeify - test - syntax nitpick --- test/unit/nodeify-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/unit') diff --git a/test/unit/nodeify-test.js b/test/unit/nodeify-test.js index f4fe320ca..537dae605 100644 --- a/test/unit/nodeify-test.js +++ b/test/unit/nodeify-test.js @@ -19,13 +19,13 @@ describe('nodeify', function () { }) it('should throw if the last argument is not a function', function (done) { - var nodified = nodeify(obj.promiseFunc, obj) + const nodified = nodeify(obj.promiseFunc, obj) try { nodified('baz') done(new Error('should have thrown if the last argument is not a function')) } catch (err) { - if (err.message === 'callback is not a function') done() - else done(err) + assert.equal(err.message, 'callback is not a function') + done() } }) }) -- cgit v1.2.3 From efb7543c6dba8a0a37044c1799a9aa906425ebd6 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 3 Aug 2017 20:53:47 -0700 Subject: test - actions - remove commented code --- test/unit/actions/tx_test.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/unit') diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index 4561082fd..267cfee97 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -48,8 +48,6 @@ describe('tx confirmation screen', function () { cancelTransaction (txId, cb) { cb() }, clearSeedWordCache (cb) { cb() }, }) - // var dispatchExpect = sinon.mock() - // dispatchExpect.once() let action actions.cancelTx({value: firstTxId})((dispatchAction) => { -- cgit v1.2.3 From d526f68c8e7d613ad79ec9383d6709651e5af77e Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 3 Aug 2017 20:56:53 -0700 Subject: test - actions - tx - fix async test --- test/unit/actions/tx_test.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test/unit') diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index 267cfee97..67c72e9a5 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -49,12 +49,11 @@ describe('tx confirmation screen', function () { clearSeedWordCache (cb) { cb() }, }) - let action - actions.cancelTx({value: firstTxId})((dispatchAction) => { - action = dispatchAction + actions.cancelTx({value: firstTxId})((action) => { + result = reducers(initialState, action) + done() }) - result = reducers(initialState, action) - done() + }) it('should transition to the account detail view', function () { -- cgit v1.2.3