mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-22 07:48:30 +00:00
* add route and nav tab for new module * add new module to tabs index * add signMessage to wallet interface * add signed message verification, normalize pkey sign * init Sign & Verify Message tab * reorder imports * mock out Trezor * cast to bool instead of length check * normalize ledger sign message * fix broken this context * add commented message signing to trezor wallet * correct var to start on sign tab * remove unused state var * clean up SignMessage classes * clean up VerifyMessage classes, remove unnecessary log * correct event variable types * remove unnecessary exports * remove empty classname * use implicit return * shorten signMessage method * remove unnecessary disable * tweak variable name * make better use of destructuring, remove console log * use destructured var * flatten if statement * add signMessage method to wallet reducer test
35 lines
946 B
TypeScript
35 lines
946 B
TypeScript
import { wallet, INITIAL_STATE } from 'reducers/wallet';
|
|
import * as walletActions from 'actions/wallet';
|
|
import Big from 'bignumber.js';
|
|
|
|
describe('wallet reducer', () => {
|
|
it('should handle WALLET_SET', () => {
|
|
const doSomething = new Promise<string>(resolve => {
|
|
setTimeout(() => resolve('Success'), 1000);
|
|
});
|
|
|
|
const walletInstance = {
|
|
getAddress: () => doSomething,
|
|
signRawTransaction: () => doSomething,
|
|
signMessage: () => doSomething
|
|
};
|
|
|
|
expect(wallet(undefined, walletActions.setWallet(walletInstance))).toEqual({
|
|
...INITIAL_STATE,
|
|
inst: walletInstance,
|
|
balance: null,
|
|
tokens: {}
|
|
});
|
|
});
|
|
|
|
it('should handle WALLET_SET_TOKEN_BALANCES', () => {
|
|
const tokenBalances = { OMG: new Big(20) };
|
|
expect(
|
|
wallet(undefined, walletActions.setTokenBalances(tokenBalances))
|
|
).toEqual({
|
|
...INITIAL_STATE,
|
|
tokens: tokenBalances
|
|
});
|
|
});
|
|
});
|