aitrean cf9887f21f Outstanding tasks to Productionize Tx (#1194)
* Verify and complete all branching saga logic tests for transaction stack.

* Write reducer tests for refactored transaction stack.

* Add selector tests. Some files still need to be debugged.

* Add snapshot test for fields, additional seelector testing.

* Remove fields snapshots.

* Remove ABIs from the TestState json

* Use redux state instead of raw json in selector testing.

* Fix merge issues.

* Remove log

* Fix state values.

* Change test value to wei.

* Last touchup.

* Fix buffer shape, change Wei typo, use reasonable wei values.

* Last touch up.
2018-03-08 12:03:45 -06:00

49 lines
1.6 KiB
TypeScript

import { RequestStatus } from 'reducers/transaction/network';
import {
getNetworkStatus,
nonceRequestPending,
nonceRequestFailed,
isNetworkRequestPending,
getGasEstimationPending,
getGasLimitEstimationTimedOut
} from 'selectors/transaction';
import { getInitialState } from '../helpers';
describe('current selector', () => {
const state = getInitialState();
state.transaction.network = {
...state.transaction.network,
gasEstimationStatus: RequestStatus.REQUESTED,
getFromStatus: RequestStatus.SUCCEEDED,
getNonceStatus: RequestStatus.REQUESTED,
gasPriceStatus: RequestStatus.SUCCEEDED
};
it('should get network status', () => {
expect(getNetworkStatus(state)).toEqual(state.transaction.network);
});
it('should check with the store if the nonce request is pending', () => {
expect(nonceRequestPending(state)).toEqual(true);
});
it('should check with the store if the nonce request failed', () => {
state.transaction.network.getNonceStatus = RequestStatus.FAILED;
expect(nonceRequestFailed(state)).toEqual(true);
});
it('should check with the store if the gas estimation is pending', () => {
expect(getGasEstimationPending(state)).toEqual(true);
});
it('should check with the store if gas limit estimation timed out', () => {
state.transaction.network.gasEstimationStatus = RequestStatus.TIMEDOUT;
expect(getGasLimitEstimationTimedOut(state)).toEqual(true);
});
it('should check with the store if network request is pending', () => {
state.transaction.network.gasEstimationStatus = RequestStatus.REQUESTED;
expect(isNetworkRequestPending(state)).toEqual(true);
});
});