2018-08-16 14:28:27 +02:00
|
|
|
import assert from 'assert'
|
|
|
|
import proxyquire from 'proxyquire'
|
|
|
|
|
|
|
|
const {
|
|
|
|
getCustomGasErrors,
|
|
|
|
getCustomGasLimit,
|
|
|
|
getCustomGasPrice,
|
|
|
|
getCustomGasTotal,
|
2018-10-24 06:22:22 +02:00
|
|
|
getEstimatedGasPrices,
|
|
|
|
getEstimatedGasTimes,
|
|
|
|
getPriceAndTimeEstimates,
|
2018-08-16 14:28:27 +02:00
|
|
|
getRenderableBasicEstimateData,
|
2018-11-13 17:36:52 +01:00
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
2019-03-22 00:03:30 +01:00
|
|
|
} = proxyquire('./custom-gas', {})
|
2018-08-16 14:28:27 +02:00
|
|
|
|
|
|
|
describe('custom-gas selectors', () => {
|
|
|
|
|
|
|
|
describe('getCustomGasPrice()', () => {
|
|
|
|
it('should return gas.customData.price', () => {
|
|
|
|
const mockState = { gas: { customData: { price: 'mockPrice' } } }
|
|
|
|
assert.equal(getCustomGasPrice(mockState), 'mockPrice')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('getCustomGasLimit()', () => {
|
|
|
|
it('should return gas.customData.limit', () => {
|
|
|
|
const mockState = { gas: { customData: { limit: 'mockLimit' } } }
|
|
|
|
assert.equal(getCustomGasLimit(mockState), 'mockLimit')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('getCustomGasTotal()', () => {
|
|
|
|
it('should return gas.customData.total', () => {
|
|
|
|
const mockState = { gas: { customData: { total: 'mockTotal' } } }
|
|
|
|
assert.equal(getCustomGasTotal(mockState), 'mockTotal')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('getCustomGasErrors()', () => {
|
|
|
|
it('should return gas.errors', () => {
|
|
|
|
const mockState = { gas: { errors: 'mockErrors' } }
|
|
|
|
assert.equal(getCustomGasErrors(mockState), 'mockErrors')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-10-24 06:22:22 +02:00
|
|
|
describe('getPriceAndTimeEstimates', () => {
|
|
|
|
it('should return price and time estimates', () => {
|
|
|
|
const mockState = { gas: { priceAndTimeEstimates: 'mockPriceAndTimeEstimates' } }
|
|
|
|
assert.equal(getPriceAndTimeEstimates(mockState), 'mockPriceAndTimeEstimates')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('getEstimatedGasPrices', () => {
|
|
|
|
it('should return price and time estimates', () => {
|
|
|
|
const mockState = { gas: { priceAndTimeEstimates: [
|
|
|
|
{ gasprice: 12, somethingElse: 20 },
|
|
|
|
{ gasprice: 22, expectedTime: 30 },
|
|
|
|
{ gasprice: 32, somethingElse: 40 },
|
|
|
|
] } }
|
|
|
|
assert.deepEqual(getEstimatedGasPrices(mockState), [12, 22, 32])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('getEstimatedGasTimes', () => {
|
|
|
|
it('should return price and time estimates', () => {
|
|
|
|
const mockState = { gas: { priceAndTimeEstimates: [
|
|
|
|
{ somethingElse: 12, expectedTime: 20 },
|
|
|
|
{ gasPrice: 22, expectedTime: 30 },
|
|
|
|
{ somethingElse: 32, expectedTime: 40 },
|
|
|
|
] } }
|
|
|
|
assert.deepEqual(getEstimatedGasTimes(mockState), [20, 30, 40])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-08-16 14:28:27 +02:00
|
|
|
describe('getRenderableBasicEstimateData()', () => {
|
|
|
|
const tests = [
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'slow',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$0.01',
|
|
|
|
feeInPrimaryCurrency: '0.0000525 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
timeEstimate: '~6 min 36 sec',
|
|
|
|
priceInHexWei: '0x9502f900',
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'average',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$0.03',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
2018-11-13 17:36:52 +01:00
|
|
|
timeEstimate: '~3 min 18 sec',
|
2018-08-16 14:28:27 +02:00
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'fast',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$0.05',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
timeEstimate: '~30 sec',
|
|
|
|
priceInHexWei: '0x2540be400',
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 255.71,
|
|
|
|
currentCurrency: 'usd',
|
2019-02-26 19:30:41 +01:00
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
2018-11-27 18:30:41 +01:00
|
|
|
safeLow: 2.5,
|
2018-08-16 14:28:27 +02:00
|
|
|
safeLowWait: 6.6,
|
2018-11-27 18:30:41 +01:00
|
|
|
fast: 5,
|
2018-11-13 17:36:52 +01:00
|
|
|
fastWait: 3.3,
|
2018-11-27 18:30:41 +01:00
|
|
|
fastest: 10,
|
2018-11-13 17:36:52 +01:00
|
|
|
fastestWait: 0.5,
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'slow',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
timeEstimate: '~13 min 12 sec',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'average',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
2018-11-13 17:36:52 +01:00
|
|
|
timeEstimate: '~6 min 36 sec',
|
2018-08-16 14:28:27 +02:00
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'fast',
|
2019-02-26 19:30:41 +01:00
|
|
|
feeInSecondaryCurrency: '$1.07',
|
|
|
|
feeInPrimaryCurrency: '0.00042 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
timeEstimate: '~1 min',
|
|
|
|
priceInHexWei: '0x4a817c800',
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
2019-02-26 19:30:41 +01:00
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 5,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 10,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 20,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
labelKey: 'slow',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
timeEstimate: '~13 min 12 sec',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'average',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
timeEstimate: '~6 min 36 sec',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'fast',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00042 ETH',
|
|
|
|
timeEstimate: '~1 min',
|
|
|
|
priceInHexWei: '0x4a817c800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 5,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 10,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 20,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
labelKey: 'slow',
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
timeEstimate: '~13 min 12 sec',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'average',
|
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
timeEstimate: '~6 min 36 sec',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'fast',
|
|
|
|
feeInSecondaryCurrency: '$1.07',
|
|
|
|
feeInPrimaryCurrency: '0.00042 ETH',
|
|
|
|
timeEstimate: '~1 min',
|
|
|
|
priceInHexWei: '0x4a817c800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 5,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 10,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 20,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
labelKey: 'slow',
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
timeEstimate: '~13 min 12 sec',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'average',
|
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
timeEstimate: '~6 min 36 sec',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelKey: 'fast',
|
|
|
|
feeInSecondaryCurrency: '$1.07',
|
|
|
|
feeInPrimaryCurrency: '0.00042 ETH',
|
|
|
|
timeEstimate: '~1 min',
|
|
|
|
priceInHexWei: '0x4a817c800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
2018-11-27 18:30:41 +01:00
|
|
|
safeLow: 5,
|
2018-08-16 14:28:27 +02:00
|
|
|
safeLowWait: 13.2,
|
2018-11-27 18:30:41 +01:00
|
|
|
fast: 10,
|
2018-11-13 17:36:52 +01:00
|
|
|
fastWait: 6.6,
|
2018-11-27 18:30:41 +01:00
|
|
|
fastest: 20,
|
2018-11-13 17:36:52 +01:00
|
|
|
fastestWait: 1.0,
|
2018-08-16 14:28:27 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
it('should return renderable data about basic estimates', () => {
|
|
|
|
tests.forEach(test => {
|
|
|
|
assert.deepEqual(
|
2018-12-12 15:54:03 +01:00
|
|
|
getRenderableBasicEstimateData(test.mockState, '0x5208'),
|
2018-08-16 14:28:27 +02:00
|
|
|
test.expectedResult
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2018-11-13 17:36:52 +01:00
|
|
|
describe('getRenderableEstimateDataForSmallButtonsFromGWEI()', () => {
|
2018-09-20 06:16:43 +02:00
|
|
|
const tests = [
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
feeInSecondaryCurrency: '$0.13',
|
|
|
|
feeInPrimaryCurrency: '0.00052 ETH',
|
|
|
|
labelKey: 'slow',
|
|
|
|
priceInHexWei: '0x5d21dba00',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
{
|
2018-11-13 17:36:52 +01:00
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'average',
|
2018-11-13 17:36:52 +01:00
|
|
|
priceInHexWei: '0xba43b7400',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
|
|
|
labelKey: 'fast',
|
|
|
|
priceInHexWei: '0x174876e800',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 255.71,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
2019-02-26 19:30:41 +01:00
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 25,
|
|
|
|
safeLowWait: 6.6,
|
2018-11-13 17:36:52 +01:00
|
|
|
fast: 50,
|
|
|
|
fastWait: 3.3,
|
|
|
|
fastest: 100,
|
|
|
|
fastestWait: 0.5,
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
|
|
|
labelKey: 'slow',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
{
|
2018-11-13 17:36:52 +01:00
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
2019-02-06 16:10:00 +01:00
|
|
|
labelKey: 'average',
|
2018-11-13 17:36:52 +01:00
|
|
|
priceInHexWei: '0x174876e800',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
{
|
2019-02-06 16:10:00 +01:00
|
|
|
feeInSecondaryCurrency: '$10.74',
|
|
|
|
feeInPrimaryCurrency: '0.0042 ETH',
|
|
|
|
labelKey: 'fast',
|
|
|
|
priceInHexWei: '0x2e90edd000',
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
2019-02-26 19:30:41 +01:00
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 50,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 100,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 200,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
|
|
|
labelKey: 'slow',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
|
|
|
labelKey: 'average',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.0042 ETH',
|
|
|
|
labelKey: 'fast',
|
|
|
|
priceInHexWei: '0x2e90edd000',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 50,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 100,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 200,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
|
|
|
labelKey: 'slow',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
|
|
|
labelKey: 'average',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$10.74',
|
|
|
|
feeInPrimaryCurrency: '0.0042 ETH',
|
|
|
|
labelKey: 'fast',
|
|
|
|
priceInHexWei: '0x2e90edd000',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 50,
|
|
|
|
safeLowWait: 13.2,
|
|
|
|
fast: 100,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 200,
|
|
|
|
fastestWait: 1.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
|
|
|
labelKey: 'slow',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
|
|
|
labelKey: 'average',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$10.74',
|
|
|
|
feeInPrimaryCurrency: '0.0042 ETH',
|
|
|
|
labelKey: 'fast',
|
|
|
|
priceInHexWei: '0x2e90edd000',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
send: {
|
|
|
|
gasLimit: '0x5208',
|
|
|
|
},
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
},
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
basicEstimates: {
|
|
|
|
blockTime: 14.16326530612245,
|
|
|
|
safeLow: 50,
|
|
|
|
safeLowWait: 13.2,
|
2018-11-13 17:36:52 +01:00
|
|
|
fast: 100,
|
|
|
|
fastWait: 6.6,
|
|
|
|
fastest: 200,
|
|
|
|
fastestWait: 1.0,
|
2018-09-20 06:16:43 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
it('should return renderable data about basic estimates appropriate for buttons with less info', () => {
|
|
|
|
tests.forEach(test => {
|
|
|
|
assert.deepEqual(
|
2018-11-13 17:36:52 +01:00
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI(test.mockState),
|
2018-09-20 06:16:43 +02:00
|
|
|
test.expectedResult
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2018-08-16 14:28:27 +02:00
|
|
|
})
|