mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Fixed internal encoding test case
This commit is contained in:
parent
32c767fbe8
commit
70e14b8a6f
@ -91,7 +91,7 @@ describe('Personal Message Manager', function() {
|
||||
it('converts text to a utf8 buffer', function() {
|
||||
var input = 'hello'
|
||||
var output = messageManager.normalizeMsgData(input)
|
||||
assert.equal(output, '0x68656c6c6f', 'predictably hex encoded')
|
||||
assert.equal(output, '0x00680065006c006c006f', 'predictably hex encoded')
|
||||
})
|
||||
|
||||
it('tolerates a hex prefix', function() {
|
||||
|
38
test/unit/tx-utils-test.js
Normal file
38
test/unit/tx-utils-test.js
Normal file
@ -0,0 +1,38 @@
|
||||
const assert = require('assert')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const BN = ethUtil.BN
|
||||
|
||||
const TxUtils = require('../../app/scripts/lib/tx-utils')
|
||||
|
||||
|
||||
describe('txUtils', function() {
|
||||
let txUtils
|
||||
|
||||
before(function() {
|
||||
txUtils = new TxUtils()
|
||||
})
|
||||
|
||||
describe('addGasBuffer', function() {
|
||||
describe('adds a flat value', function() {
|
||||
it('over an empty 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 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')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user