MyCrypto/spec/reducers/gas.spec.ts
William O'Beirne c76d0b3fa5 Handle Gas / Estimates on a Per Network Basis (#1160)
* 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
2018-02-24 12:00:00 -06:00

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
});
});
});