aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-17 02:57:07 +0800
committerkumavis <aaron@kumavis.me>2018-05-17 02:57:07 +0800
commitc27d9162d7001fa2bd6cfb98dd110716951d2d1b (patch)
tree19f5d4780b3ee82c0e9c9fe2a9c2edad745dd084 /test/unit
parenta1d13d45cf7451162b071e5507f1e31b12574e6e (diff)
parent6e79225dbff512ab9bcae2731bcfc4ce33e98664 (diff)
downloadtangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.gz
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.bz2
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.lz
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.xz
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.zst
tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-controller-remove-setNetworkEndpoints
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/tx-controller-test.js30
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()