aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-04-20 08:32:09 +0800
committerDan Finlay <dan@danfinlay.com>2016-04-20 08:32:09 +0800
commit901d23a02904a859901ca4f0bf5a6e42684567ec (patch)
tree5a84e24e460f1a50140f891809e49c3d95f9c5ce /test
parent0a0a631af29eb1547f18f2f8072670db0e415372 (diff)
downloadtangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar.gz
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar.bz2
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar.lz
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar.xz
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.tar.zst
tangerine-wallet-browser-901d23a02904a859901ca4f0bf5a6e42684567ec.zip
Add extra tx methods to configManager
Diffstat (limited to 'test')
-rw-r--r--test/unit/config-manager-test.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js
index 84632b0ea..a5ddf78a4 100644
--- a/test/unit/config-manager-test.js
+++ b/test/unit/config-manager-test.js
@@ -126,6 +126,16 @@ describe('config-manager', function() {
})
})
+ describe('#updateTx', function() {
+ it('replaces the tx with the same id', function() {
+ configManager.addTx({ id: '1', status: 'unconfirmed' })
+ configManager.addTx({ id: '2', status: 'confirmed' })
+ configManager.updateTx({ id: '1', status: 'blah', hash: 'foo' })
+ var result = configManager.getTx('1')
+ assert.equal(result.hash, 'foo')
+ })
+ })
+
describe('#unconfirmedTxs', function() {
it('returns unconfirmed txs in a hash', function() {
configManager.addTx({ id: '1', status: 'unconfirmed' })
@@ -146,5 +156,31 @@ describe('config-manager', function() {
assert.equal(configManager.getTx('2').status, 'confirmed')
})
})
+
+ describe('#getTxWithParams', function() {
+ it('returns a tx with the matching params', function() {
+ configManager.addTx({ id: '1', status: 'unconfirmed', txParams: {
+ from: 'from',
+ to: 'to',
+ data: 'data',
+ value: 'value',
+ }
+ })
+ configManager.addTx({ id: '2', status: 'unconfirmed', txParams: {
+ from: 'from1',
+ to: 'to',
+ data: 'data',
+ value: 'value',
+ }
+ })
+ var result = configManager.getTxWithParams({
+ from: 'from',
+ to: 'to',
+ data: 'data',
+ value: 'value',
+ })
+ assert.equal(result.id, '1')
+ })
+ })
})
})