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

45 lines
1.2 KiB
TypeScript

import {
signaturePending,
getSignedTx,
getWeb3Tx,
getSignState,
getSerializedTransaction
} from 'selectors/transaction/sign';
import { getInitialState } from '../helpers';
describe('sign tests', () => {
const state = getInitialState();
(state.transaction.sign = {
indexingHash: 'testIndexingHash',
pending: false,
local: {
signedTransaction: new Buffer([4, 5, 6, 7])
},
web3: {
transaction: null
}
}),
it('should return whether the current signature is pending', () => {
expect(signaturePending(state)).toEqual({
isHardwareWallet: false,
isSignaturePending: false
});
});
it('should should get the stored sign state', () => {
expect(getSignState(state)).toEqual(state.transaction.sign);
});
it('should get the signed local transaction state', () => {
expect(getSignedTx(state)).toEqual(state.transaction.sign.local.signedTransaction);
});
it('should get the signed web3 transaction state', () => {
expect(getWeb3Tx(state)).toEqual(state.transaction.sign.web3.transaction);
});
it('should get the serialized transaction state', () => {
expect(getSerializedTransaction(state)).toEqual(new Buffer([4, 5, 6, 7]));
});
});