aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-07-12 03:41:03 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-07-12 03:41:03 +0800
commit971d25a8ab9fecbad041e3df1696bf67245bd858 (patch)
tree257ebef4fc679fede3ef7276879086cb250166da /test
parenta670e54973ed1bae20455507a4b3c44e231ba822 (diff)
parenta1fd9bc6bebcad4421a10ab85f525b9686103549 (diff)
downloadtangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.gz
tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.zst
tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.zip
Merge branch 'master' into nonce-tracker
Diffstat (limited to 'test')
-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 = {