diff options
author | Thomas <thomas.b.huang@gmail.com> | 2018-05-08 22:11:29 +0800 |
---|---|---|
committer | Thomas <thomas.b.huang@gmail.com> | 2018-05-08 22:11:29 +0800 |
commit | 6c9b303dbd37b0ccad98d05a7b88824bf65de542 (patch) | |
tree | bf581bb3e98ed5a98ec85248e976a357d3bde58e /test | |
parent | f7a3d8887cf7e6fd198e3143825f0f8a50765376 (diff) | |
parent | caf5a6c15c3375d9d64116d80d87eb064e955e59 (diff) | |
download | tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.gz tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.bz2 tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.lz tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.xz tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.zst tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.zip |
Merge branch 'develop' into e2e-tests
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tx-controller-test.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index 0b5c7226a..ddd921652 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -40,6 +40,36 @@ describe('Transaction Controller', function () { txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop }) }) + describe('#isNonceTaken', function () { + it('should return true', function (done) { + txController.txStateManager._saveTxList([ + { id: 1, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + { id: 2, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + { id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + ]) + txController.isNonceTaken({txParams: {nonce:0, from:'0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'}}) + .then((isNonceTaken) => { + assert(isNonceTaken) + done() + }).catch(done) + + }) + it('should return false', function (done) { + txController.txStateManager._saveTxList([ + { id: 1, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + { id: 2, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + { id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} }, + ]) + + txController.isNonceTaken({txParams: {nonce:0, from:'0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'}}) + .then((isNonceTaken) => { + assert(!isNonceTaken) + done() + }).catch(done) + + }) + }) + describe('#getState', function () { it('should return a state object with the right keys and datat types', function () { const exposedState = txController.getState() |