mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
test for SufficientBalance
This commit is contained in:
parent
caee2a9e35
commit
4ac0b97202
41
test/unit/util-test.js
Normal file
41
test/unit/util-test.js
Normal file
@ -0,0 +1,41 @@
|
||||
const assert = require('assert')
|
||||
const { sufficientBalance } = require('../../app/scripts/lib/util')
|
||||
|
||||
|
||||
describe.only('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.')
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user