mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
add gas buffer multiply test
This commit is contained in:
parent
4256e631a6
commit
de44cd9ba4
@ -13,26 +13,16 @@ describe('txUtils', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('addGasBuffer', function() {
|
describe('addGasBuffer', function() {
|
||||||
describe('adds a flat value', function() {
|
describe('multiplies by 1.5', function() {
|
||||||
it('over an empty value', function() {
|
it('over a value', function() {
|
||||||
const input = '0x0'
|
|
||||||
const output = txUtils.addGasBuffer(input)
|
|
||||||
assert.notEqual(output, input, 'changed the value')
|
|
||||||
|
|
||||||
const inputBn = new BN(input, 'hex')
|
|
||||||
const outputBn = new BN(output, 'hex')
|
|
||||||
assert(outputBn.gt(inputBn), 'returns a greater value')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('over an value', function() {
|
|
||||||
const input = '0x123fad'
|
const input = '0x123fad'
|
||||||
const output = txUtils.addGasBuffer(input)
|
const output = txUtils.addGasBuffer(input, '0x3d4c52') //0x3d4c52 is 4mil for dummy gas limit
|
||||||
assert.notEqual(output, input, 'changed the value')
|
|
||||||
|
|
||||||
const inputBn = new BN(input, 'hex')
|
const inputBn = new BN(input, 'hex')
|
||||||
const outputBn = new BN(output, 'hex')
|
const outputBn = new BN(output, 'hex')
|
||||||
assert(outputBn.gt(inputBn), 'returns a greater value')
|
const expectedBn = inputBn.mul(1.5)
|
||||||
|
assert(outputBn.eq(expectedBn), 'returns 1.5 the input value')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user