aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-07-12 03:29:20 +0800
committerGitHub <noreply@github.com>2017-07-12 03:29:20 +0800
commita1fd9bc6bebcad4421a10ab85f525b9686103549 (patch)
tree01ac51e1506cd5c7a989cb6e071982e72f1714b4 /test
parent0eee232e26dec61512e36bedf131ce0f7ce1ddd4 (diff)
parentc7b9e3fb1878cebbab26d5343cc18084a601c6bb (diff)
downloadtangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar.gz
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar.bz2
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar.lz
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar.xz
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.tar.zst
tangerine-wallet-browser-a1fd9bc6bebcad4421a10ab85f525b9686103549.zip
Merge pull request #1762 from MetaMask/ImproveRetryLogic
Improve retry logic
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 = {