aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-09 05:24:40 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-09 05:24:40 +0800
commit9b9df417246dbf332f0a7d8afadb664544ceb484 (patch)
tree4459d9272defce22c54e301d518bc1d4efab7f2f /test
parent50075c6df5af4441db78b47f3bc2036a65228224 (diff)
downloadtangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.gz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.bz2
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.lz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.xz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.zst
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.zip
more tests and craete a getPendingTransactions function
Diffstat (limited to 'test')
-rw-r--r--test/unit/components/pending-tx-test.js3
-rw-r--r--test/unit/tx-controller-test.js22
2 files changed, 24 insertions, 1 deletions
diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js
index 22a98bc93..906564558 100644
--- a/test/unit/components/pending-tx-test.js
+++ b/test/unit/components/pending-tx-test.js
@@ -24,7 +24,8 @@ describe('PendingTx', function () {
'to': '0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb',
'value': '0xde0b6b3a7640000',
gasPrice,
- 'gas': '0x7b0c'},
+ 'gas': '0x7b0c',
+ },
'gasLimitSpecified': false,
'estimatedGas': '0x5208',
}
diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js
index f969752ec..937ac55de 100644
--- a/test/unit/tx-controller-test.js
+++ b/test/unit/tx-controller-test.js
@@ -37,6 +37,28 @@ describe('Transaction Controller', function () {
txController.txProviderUtils = new TxGasUtils(txController.provider)
})
+ describe('#getState', function () {
+ it('should return a state object with the right keys and datat types', function (){
+ const exposedState = txController.getState()
+ assert('unapprovedTxs' in exposedState, 'state should have the key unapprovedTxs')
+ assert('selectedAddressTxList' in exposedState, 'state should have the key selectedAddressTxList')
+ assert(typeof exposedState.unapprovedTxs === 'object', 'should be an object')
+ assert(Array.isArray(exposedState.selectedAddressTxList), 'should be an array')
+ })
+ })
+
+ describe('#getUnapprovedTxCount', function () {
+ it('should return the number of unapproved txs', function () {
+ txController.txStateManager._saveTxList([
+ { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} },
+ { id: 2, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} },
+ { id: 3, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} },
+ ])
+ const unapprovedTxCount = txController.getUnapprovedTxCount()
+ assert.equal(unapprovedTxCount, 3, 'should be 3')
+ })
+ })
+
describe('#newUnapprovedTransaction', function () {
let stub, txMeta, txParams
beforeEach(function () {