mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Refactor util tests.
This commit is contained in:
parent
5bb075a278
commit
31d0d1ec08
@ -17,28 +17,25 @@ describe('util', function() {
|
|||||||
this.sinon.restore()
|
this.sinon.restore()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('parseBalance', function() {
|
describe('#parseBalance', function() {
|
||||||
it('should render 0.01 eth correctly', function() {
|
it('should render 0.01 eth correctly', function() {
|
||||||
const input = '0x2386F26FC10000'
|
const input = '0x2386F26FC10000'
|
||||||
const output = util.parseBalance(input)
|
const output = util.parseBalance(input)
|
||||||
assert.deepEqual(output, ['0', '01'])
|
assert.deepEqual(output, ['0', '01'])
|
||||||
})
|
})
|
||||||
})
|
|
||||||
describe('parseBalance', function() {
|
|
||||||
it('should render 12.023 eth correctly', function() {
|
it('should render 12.023 eth correctly', function() {
|
||||||
const input = 'A6DA46CCA6858000'
|
const input = 'A6DA46CCA6858000'
|
||||||
const output = util.parseBalance(input)
|
const output = util.parseBalance(input)
|
||||||
assert.deepEqual(output, ['12', '023'])
|
assert.deepEqual(output, ['12', '023'])
|
||||||
})
|
})
|
||||||
})
|
|
||||||
describe('parseBalance', function() {
|
|
||||||
it('should render 0.0000000342422 eth correctly', function() {
|
it('should render 0.0000000342422 eth correctly', function() {
|
||||||
const input = '0x7F8FE81C0'
|
const input = '0x7F8FE81C0'
|
||||||
const output = util.parseBalance(input)
|
const output = util.parseBalance(input)
|
||||||
assert.deepEqual(output, ['0', '0000000342422'])
|
assert.deepEqual(output, ['0', '0000000342422'])
|
||||||
})
|
})
|
||||||
})
|
|
||||||
describe('parseBalance', function() {
|
|
||||||
it('should render 0 eth correctly', function() {
|
it('should render 0 eth correctly', function() {
|
||||||
const input = '0x0'
|
const input = '0x0'
|
||||||
const output = util.parseBalance(input)
|
const output = util.parseBalance(input)
|
||||||
@ -46,7 +43,7 @@ describe('util', function() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('addressSummary', function() {
|
describe('#addressSummary', function() {
|
||||||
it('should add case-sensitive checksum', function() {
|
it('should add case-sensitive checksum', function() {
|
||||||
var address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
|
var address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
|
||||||
var result = util.addressSummary(address)
|
var result = util.addressSummary(address)
|
||||||
@ -60,7 +57,7 @@ describe('util', function() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('isValidAddress', function() {
|
describe('#isValidAddress', function() {
|
||||||
it('should allow 40-char non-prefixed hex', function() {
|
it('should allow 40-char non-prefixed hex', function() {
|
||||||
var address = 'fdea65c8e26263f6d9a1b5de9555d2931a33b825'
|
var address = 'fdea65c8e26263f6d9a1b5de9555d2931a33b825'
|
||||||
var result = util.isValidAddress(address)
|
var result = util.isValidAddress(address)
|
||||||
@ -106,7 +103,7 @@ describe('util', function() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('numericBalance', function() {
|
describe('#numericBalance', function() {
|
||||||
|
|
||||||
it('should return a BN 0 if given nothing', function() {
|
it('should return a BN 0 if given nothing', function() {
|
||||||
var result = util.numericBalance()
|
var result = util.numericBalance()
|
||||||
@ -211,7 +208,7 @@ describe('util', function() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('normalizeEthStringToWei', function() {
|
describe('#normalizeEthStringToWei', function() {
|
||||||
it('should convert decimal eth to pure wei BN', function() {
|
it('should convert decimal eth to pure wei BN', function() {
|
||||||
var input = '1.23456789'
|
var input = '1.23456789'
|
||||||
var output = util.normalizeEthStringToWei(input)
|
var output = util.normalizeEthStringToWei(input)
|
||||||
|
Loading…
Reference in New Issue
Block a user