aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-utils-test.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-07-21 03:39:06 +0800
committerDan Finlay <dan@danfinlay.com>2017-07-21 03:39:06 +0800
commita41e5788cf4a8e680fdbc4d16690a8f5cc8af265 (patch)
tree5c546e149ce0cf2d88bbef1d1645b124f11d0eb5 /test/unit/tx-utils-test.js
parent86d367957fe8ac04462f716fe0ba2bfa4e5ff3f6 (diff)
parent9b24ab0e70d72471ddc928a763bc2096790ab966 (diff)
downloadtangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar.gz
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar.bz2
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar.lz
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar.xz
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.tar.zst
tangerine-wallet-browser-a41e5788cf4a8e680fdbc4d16690a8f5cc8af265.zip
Merge branch 'master' into NewUI
Diffstat (limited to 'test/unit/tx-utils-test.js')
-rw-r--r--test/unit/tx-utils-test.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js
index 7ace1f587..a43bcfb35 100644
--- a/test/unit/tx-utils-test.js
+++ b/test/unit/tx-utils-test.js
@@ -16,6 +16,44 @@ describe('txUtils', function () {
}))
})
+ describe('#sufficientBalance', function () {
+ it('returns true if max tx cost is equal to balance.', function () {
+ const tx = {
+ 'value': '0x1',
+ 'gas': '0x2',
+ 'gasPrice': '0x3',
+ }
+ const balance = '0x8'
+
+ const result = txUtils.sufficientBalance(tx, balance)
+ assert.ok(result, 'sufficient balance found.')
+ })
+
+ it('returns true if max tx cost is less than balance.', function () {
+ const tx = {
+ 'value': '0x1',
+ 'gas': '0x2',
+ 'gasPrice': '0x3',
+ }
+ const balance = '0x9'
+
+ const result = txUtils.sufficientBalance(tx, balance)
+ assert.ok(result, 'sufficient balance found.')
+ })
+
+ it('returns false if max tx cost is more than balance.', function () {
+ const tx = {
+ 'value': '0x1',
+ 'gas': '0x2',
+ 'gasPrice': '0x3',
+ }
+ const balance = '0x6'
+
+ const result = txUtils.sufficientBalance(tx, balance)
+ assert.ok(!result, 'insufficient balance found.')
+ })
+ })
+
describe('chain Id', function () {
it('prepares a transaction with the provided chainId', function () {
const txParams = {