diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-08-09 14:30:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 14:30:58 +0800 |
commit | 0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e (patch) | |
tree | 428154973b91dfb2f8519777e67da7a6c75530b3 /test/unit/util-test.js | |
parent | 5e9926b0d035a5ba946080e94777ac0bd887d396 (diff) | |
parent | 57f6fce6b2524c4b36b591da5e600d0652f4077e (diff) | |
download | tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.gz tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.zst tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.zip |
Merge branch 'master' into NewUI-flat
Diffstat (limited to 'test/unit/util-test.js')
-rw-r--r-- | test/unit/util-test.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/util-test.js b/test/unit/util-test.js new file mode 100644 index 000000000..6da185b2c --- /dev/null +++ b/test/unit/util-test.js @@ -0,0 +1,41 @@ +const assert = require('assert') +const { sufficientBalance } = require('../../app/scripts/lib/util') + + +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 = 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 = 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 = sufficientBalance(tx, balance) + assert.ok(!result, 'insufficient balance found.') + }) +})
\ No newline at end of file |