mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 11:05:47 +00:00
c76d0b3fa5
* Give each network the ability to specify default estimates, and whether or not they should fetch estimates from API. Convert gas slider to always use estimates. * Fix gas cache invalidation, invalid too high / low logic. * Fix up tests. * tscheck
32 lines
791 B
TypeScript
32 lines
791 B
TypeScript
import { gas, INITIAL_STATE } from 'reducers/gas';
|
|
import { fetchGasEstimates, setGasEstimates } from 'actions/gas';
|
|
import { GasEstimates } from 'api/gas';
|
|
|
|
describe('gas reducer', () => {
|
|
it('should handle GAS_FETCH_ESTIMATES', () => {
|
|
const state = gas(undefined, fetchGasEstimates());
|
|
expect(state).toEqual({
|
|
...INITIAL_STATE,
|
|
isEstimating: true
|
|
});
|
|
});
|
|
|
|
it('should handle GAS_SET_ESTIMATES', () => {
|
|
const estimates: GasEstimates = {
|
|
safeLow: 1,
|
|
standard: 1,
|
|
fast: 4,
|
|
fastest: 20,
|
|
time: Date.now(),
|
|
chainId: 1,
|
|
isDefault: false
|
|
};
|
|
const state = gas(undefined, setGasEstimates(estimates));
|
|
expect(state).toEqual({
|
|
...INITIAL_STATE,
|
|
estimates,
|
|
isEstimating: false
|
|
});
|
|
});
|
|
});
|