|
|
@ -6,6 +6,7 @@ const { |
|
|
|
getCustomGasPrice, |
|
|
|
getCustomGasPrice, |
|
|
|
getRenderableBasicEstimateData, |
|
|
|
getRenderableBasicEstimateData, |
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI, |
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI, |
|
|
|
|
|
|
|
isCustomPriceSafe, |
|
|
|
} = proxyquire('../custom-gas', {}); |
|
|
|
} = proxyquire('../custom-gas', {}); |
|
|
|
|
|
|
|
|
|
|
|
describe('custom-gas selectors', function () { |
|
|
|
describe('custom-gas selectors', function () { |
|
|
@ -15,6 +16,44 @@ describe('custom-gas selectors', function () { |
|
|
|
assert.strictEqual(getCustomGasPrice(mockState), 'mockPrice'); |
|
|
|
assert.strictEqual(getCustomGasPrice(mockState), 'mockPrice'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('isCustomGasPriceSafe()', function () { |
|
|
|
|
|
|
|
it('should return true for gas.customData.price 0x77359400', function () { |
|
|
|
|
|
|
|
const mockState = { |
|
|
|
|
|
|
|
gas: { |
|
|
|
|
|
|
|
customData: { price: '0x77359400' }, |
|
|
|
|
|
|
|
basicEstimates: { safeLow: 1 }, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
assert.strictEqual(isCustomPriceSafe(mockState), true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it('should return true for gas.customData.price null', function () { |
|
|
|
|
|
|
|
const mockState = { |
|
|
|
|
|
|
|
gas: { |
|
|
|
|
|
|
|
customData: { price: null }, |
|
|
|
|
|
|
|
basicEstimates: { safeLow: 1 }, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
assert.strictEqual(isCustomPriceSafe(mockState), true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it('should return true gas.customData.price undefined', function () { |
|
|
|
|
|
|
|
const mockState = { |
|
|
|
|
|
|
|
gas: { |
|
|
|
|
|
|
|
customData: { price: undefined }, |
|
|
|
|
|
|
|
basicEstimates: { safeLow: 1 }, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
assert.strictEqual(isCustomPriceSafe(mockState), true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it('should return false gas.basicEstimates.safeLow undefined', function () { |
|
|
|
|
|
|
|
const mockState = { |
|
|
|
|
|
|
|
gas: { |
|
|
|
|
|
|
|
customData: { price: '0x77359400' }, |
|
|
|
|
|
|
|
basicEstimates: { safeLow: undefined }, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
assert.strictEqual(isCustomPriceSafe(mockState), false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('getCustomGasLimit()', function () { |
|
|
|
describe('getCustomGasLimit()', function () { |
|
|
|
it('should return gas.customData.limit', function () { |
|
|
|
it('should return gas.customData.limit', function () { |
|
|
|