1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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.')
})
})
|