diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-07-14 03:25:43 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-07-14 03:25:43 +0800 |
commit | 7eccf5905a830853bbb1932dde9a7f4536d43f55 (patch) | |
tree | 7f7b8b67b0e02e215b393ec95355f7dd4560649a /test | |
parent | d6001daab81f1ad8b011363635dbe61322c1482a (diff) | |
download | tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar.gz tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar.bz2 tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar.lz tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar.xz tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.tar.zst tangerine-wallet-browser-7eccf5905a830853bbb1932dde9a7f4536d43f55.zip |
make publishTransaction and signTransaction async methods
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tx-controller-test.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index a5af13915..7b86cfe14 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -270,7 +270,7 @@ describe('Transaction Controller', function () { }) - it('does not overwrite set values', function () { + it('does not overwrite set values', function (done) { this.timeout(15000) const wrongValue = '0x05' @@ -283,37 +283,35 @@ describe('Transaction Controller', function () { .callsArgWithAsync(0, null, wrongValue) - const signStub = sinon.stub(txController, 'signTransaction') - .callsArgWithAsync(1, null, noop) + const signStub = sinon.stub(txController, 'signTransaction', () => Promise.resolve()) - const pubStub = sinon.stub(txController.txProviderUtils, 'publishTransaction') - .callsArgWithAsync(1, null, originalValue) + const pubStub = sinon.stub(txController.txProviderUtils, 'publishTransaction', () => Promise.resolve(originalValue)) - return txController.approveTransaction(txMeta.id).then(() => { + txController.approveTransaction(txMeta.id).then(() => { const result = txController.getTx(txMeta.id) const params = result.txParams assert.equal(params.gas, originalValue, 'gas unmodified') assert.equal(params.gasPrice, originalValue, 'gas price unmodified') - assert.equal(result.hash, originalValue, 'hash was set') + assert.equal(result.hash, originalValue, `hash was set \n got: ${result.hash} \n expected: ${originalValue}`) estimateStub.restore() priceStub.restore() signStub.restore() pubStub.restore() - }) + done() + }).catch(done) }) }) describe('#sign replay-protected tx', function () { it('prepares a tx with the chainId set', function (done) { txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop) - txController.signTransaction('1', (err, rawTx) => { - if (err) return done('it should not fail') + txController.signTransaction('1').then((rawTx) => { const ethTx = new EthTx(ethUtil.toBuffer(rawTx)) assert.equal(ethTx.getChainId(), currentNetworkId) done() - }) + }).catch(done) }) }) |