mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
Convert actions.js to typescript (#17446)
This commit is contained in:
parent
769efc9fe3
commit
31897b542d
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"appState": {
|
"appState": {
|
||||||
"shouldClose": false,
|
|
||||||
"menuOpen": false,
|
"menuOpen": false,
|
||||||
"modal": {
|
"modal": {
|
||||||
"open": false,
|
"open": false,
|
||||||
|
@ -407,6 +407,7 @@
|
|||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"@types/remote-redux-devtools": "^0.5.5",
|
"@types/remote-redux-devtools": "^0.5.5",
|
||||||
|
"@types/w3c-web-hid": "^1.0.3",
|
||||||
"@types/watchify": "^3.11.1",
|
"@types/watchify": "^3.11.1",
|
||||||
"@types/yargs": "^17.0.8",
|
"@types/yargs": "^17.0.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
||||||
|
12
types/global.d.ts
vendored
Normal file
12
types/global.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// In order for variables to be considered on the global scope they must be
|
||||||
|
// declared using var and not const or let, which is why this rule is disabled
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
|
declare class Platform {
|
||||||
|
openTab: (opts: { url: string }) => void;
|
||||||
|
|
||||||
|
closeCurrentWindow: () => void;
|
||||||
|
}
|
||||||
|
export declare global {
|
||||||
|
var platform: Platform;
|
||||||
|
}
|
@ -8,7 +8,7 @@ import mockState from '../../../../test/data/mock-state.json';
|
|||||||
|
|
||||||
import GasTiming from '.';
|
import GasTiming from '.';
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => ({
|
jest.mock('../../../store/actions.ts', () => ({
|
||||||
getGasFeeTimeEstimate: jest.fn().mockImplementation(() => Promise.resolve()),
|
getGasFeeTimeEstimate: jest.fn().mockImplementation(() => Promise.resolve()),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ jest.mock('react-router-dom', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => ({
|
jest.mock('../../../store/actions.ts', () => ({
|
||||||
detectNewTokens: jest.fn(),
|
detectNewTokens: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import AccountDetailsModal from '.';
|
|||||||
|
|
||||||
const mockShowModal = jest.fn();
|
const mockShowModal = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../../../store/actions.js', () => {
|
jest.mock('../../../../store/actions.ts', () => {
|
||||||
return {
|
return {
|
||||||
showModal: () => mockShowModal,
|
showModal: () => mockShowModal,
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ const mockCreateCancelTransaction = jest.fn();
|
|||||||
const mockShowModal = jest.fn();
|
const mockShowModal = jest.fn();
|
||||||
const mockHideModal = jest.fn();
|
const mockHideModal = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../../../store/actions.js', () => {
|
jest.mock('../../../../store/actions.ts', () => {
|
||||||
return {
|
return {
|
||||||
createCancelTransaction: () => mockCreateCancelTransaction,
|
createCancelTransaction: () => mockCreateCancelTransaction,
|
||||||
showModal: () => mockShowModal,
|
showModal: () => mockShowModal,
|
||||||
|
@ -7,7 +7,7 @@ import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|||||||
import mockState from '../../../../test/data/mock-state.json';
|
import mockState from '../../../../test/data/mock-state.json';
|
||||||
import TransactionListItemDetails from '.';
|
import TransactionListItemDetails from '.';
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => ({
|
jest.mock('../../../store/actions.ts', () => ({
|
||||||
tryReverseResolveAddress: () => jest.fn(),
|
tryReverseResolveAddress: () => jest.fn(),
|
||||||
getGasFeeEstimatesAndStartPolling: jest.fn().mockResolvedValue(),
|
getGasFeeEstimatesAndStartPolling: jest.fn().mockResolvedValue(),
|
||||||
addPollingTokenToAppState: jest.fn(),
|
addPollingTokenToAppState: jest.fn(),
|
||||||
|
@ -42,7 +42,7 @@ describe('App State', () => {
|
|||||||
it('opens alert', () => {
|
it('opens alert', () => {
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.ALERT_OPEN,
|
type: actions.ALERT_OPEN,
|
||||||
value: 'test message',
|
payload: 'test message',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(state.alertOpen).toStrictEqual(true);
|
expect(state.alertOpen).toStrictEqual(true);
|
||||||
@ -243,7 +243,7 @@ describe('App State', () => {
|
|||||||
};
|
};
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.SET_HARDWARE_WALLET_DEFAULT_HD_PATH,
|
type: actions.SET_HARDWARE_WALLET_DEFAULT_HD_PATH,
|
||||||
value: {
|
payload: {
|
||||||
device: HardwareDeviceNames.ledger,
|
device: HardwareDeviceNames.ledger,
|
||||||
path: "m/44'/60'/0'",
|
path: "m/44'/60'/0'",
|
||||||
},
|
},
|
||||||
@ -255,7 +255,7 @@ describe('App State', () => {
|
|||||||
it('shows loading message', () => {
|
it('shows loading message', () => {
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.SHOW_LOADING,
|
type: actions.SHOW_LOADING,
|
||||||
value: 'loading',
|
payload: 'loading',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(state.isLoading).toStrictEqual(true);
|
expect(state.isLoading).toStrictEqual(true);
|
||||||
@ -276,7 +276,7 @@ describe('App State', () => {
|
|||||||
it('displays warning', () => {
|
it('displays warning', () => {
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.DISPLAY_WARNING,
|
type: actions.DISPLAY_WARNING,
|
||||||
value: 'warning',
|
payload: 'warning',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(state.isLoading).toStrictEqual(false);
|
expect(state.isLoading).toStrictEqual(false);
|
||||||
@ -296,7 +296,7 @@ describe('App State', () => {
|
|||||||
it('shows private key', () => {
|
it('shows private key', () => {
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.SHOW_PRIVATE_KEY,
|
type: actions.SHOW_PRIVATE_KEY,
|
||||||
value: 'private key',
|
payload: 'private key',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(state.accountDetail.privateKey).toStrictEqual('private key');
|
expect(state.accountDetail.privateKey).toStrictEqual('private key');
|
||||||
@ -305,7 +305,7 @@ describe('App State', () => {
|
|||||||
it('set mouse user state', () => {
|
it('set mouse user state', () => {
|
||||||
const state = reduceApp(metamaskState, {
|
const state = reduceApp(metamaskState, {
|
||||||
type: actions.SET_MOUSE_USER_STATE,
|
type: actions.SET_MOUSE_USER_STATE,
|
||||||
value: true,
|
payload: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(state.isMouseUser).toStrictEqual(true);
|
expect(state.isMouseUser).toStrictEqual(true);
|
||||||
|
@ -159,7 +159,7 @@ export default function reduceApp(
|
|||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
alertOpen: true,
|
alertOpen: true,
|
||||||
alertMessage: action.value,
|
alertMessage: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.ALERT_CLOSE:
|
case actionConstants.ALERT_CLOSE:
|
||||||
@ -263,27 +263,10 @@ export default function reduceApp(
|
|||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.COMPLETED_TX:
|
case actionConstants.COMPLETED_TX:
|
||||||
if (action.value.unconfirmedActionsCount > 0) {
|
|
||||||
return {
|
|
||||||
...appState,
|
|
||||||
txId: null,
|
|
||||||
warning: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
// indicate notification should close
|
|
||||||
shouldClose: true,
|
|
||||||
warning: null,
|
warning: null,
|
||||||
txId: null,
|
txId: null,
|
||||||
accountDetail: {
|
|
||||||
subview: 'transactions',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
case actionConstants.TRANSACTION_ERROR:
|
|
||||||
return {
|
|
||||||
...appState,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.UNLOCK_FAILED:
|
case actionConstants.UNLOCK_FAILED:
|
||||||
@ -299,7 +282,7 @@ export default function reduceApp(
|
|||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_HARDWARE_WALLET_DEFAULT_HD_PATH: {
|
case actionConstants.SET_HARDWARE_WALLET_DEFAULT_HD_PATH: {
|
||||||
const { device, path } = action.value;
|
const { device, path } = action.payload;
|
||||||
const newDefaults = { ...appState.defaultHdPaths } as any;
|
const newDefaults = { ...appState.defaultHdPaths } as any;
|
||||||
newDefaults[device] = path;
|
newDefaults[device] = path;
|
||||||
|
|
||||||
@ -313,7 +296,7 @@ export default function reduceApp(
|
|||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
loadingMessage: action.value,
|
loadingMessage: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.HIDE_LOADING:
|
case actionConstants.HIDE_LOADING:
|
||||||
@ -325,7 +308,7 @@ export default function reduceApp(
|
|||||||
case actionConstants.DISPLAY_WARNING:
|
case actionConstants.DISPLAY_WARNING:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
warning: action.value,
|
warning: action.payload,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -339,46 +322,44 @@ export default function reduceApp(
|
|||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
accountDetail: {
|
accountDetail: {
|
||||||
subview: 'export',
|
privateKey: action.payload,
|
||||||
accountExport: 'completed',
|
|
||||||
privateKey: action.value,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_MOUSE_USER_STATE:
|
case actionConstants.SET_MOUSE_USER_STATE:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
isMouseUser: action.value,
|
isMouseUser: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_SELECTED_SETTINGS_RPC_URL:
|
case actionConstants.SET_SELECTED_SETTINGS_RPC_URL:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
networksTabSelectedRpcUrl: action.value,
|
networksTabSelectedRpcUrl: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_NEW_NETWORK_ADDED:
|
case actionConstants.SET_NEW_NETWORK_ADDED:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
newNetworkAdded: action.value,
|
newNetworkAdded: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_NEW_TOKENS_IMPORTED:
|
case actionConstants.SET_NEW_TOKENS_IMPORTED:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
newTokensImported: action.value,
|
newTokensImported: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_NEW_COLLECTIBLE_ADDED_MESSAGE:
|
case actionConstants.SET_NEW_COLLECTIBLE_ADDED_MESSAGE:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
newCollectibleAddedMessage: action.value,
|
newCollectibleAddedMessage: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.SET_REMOVE_COLLECTIBLE_MESSAGE:
|
case actionConstants.SET_REMOVE_COLLECTIBLE_MESSAGE:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
removeCollectibleMessage: action.value,
|
removeCollectibleMessage: action.payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.PORTFOLIO_TOOLTIP_WAS_SHOWN_IN_THIS_SESSION:
|
case actionConstants.PORTFOLIO_TOOLTIP_WAS_SHOWN_IN_THIS_SESSION:
|
||||||
@ -396,13 +377,7 @@ export default function reduceApp(
|
|||||||
case actionConstants.SET_OPEN_METAMASK_TAB_IDS:
|
case actionConstants.SET_OPEN_METAMASK_TAB_IDS:
|
||||||
return {
|
return {
|
||||||
...appState,
|
...appState,
|
||||||
openMetaMaskTabs: action.value,
|
openMetaMaskTabs: action.payload,
|
||||||
};
|
|
||||||
|
|
||||||
case actionConstants.SET_CURRENT_WINDOW_TAB:
|
|
||||||
return {
|
|
||||||
...appState,
|
|
||||||
currentWindowTab: action.value,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case actionConstants.HIDE_WHATS_NEW_POPUP:
|
case actionConstants.HIDE_WHATS_NEW_POPUP:
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import * as actionConstants from '../../store/actionConstants';
|
import * as actionConstants from '../../store/actionConstants';
|
||||||
|
|
||||||
export default function reduceLocaleMessages(state = {}, { type, value }) {
|
export default function reduceLocaleMessages(state = {}, { type, payload }) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case actionConstants.SET_CURRENT_LOCALE:
|
case actionConstants.SET_CURRENT_LOCALE:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
current: value.messages,
|
current: payload.messages,
|
||||||
currentLocale: value.locale,
|
currentLocale: payload.locale,
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
@ -162,7 +162,7 @@ export default function reduceMetamask(state = initialState, action) {
|
|||||||
case actionConstants.SET_NEXT_NONCE: {
|
case actionConstants.SET_NEXT_NONCE: {
|
||||||
return {
|
return {
|
||||||
...metamaskState,
|
...metamaskState,
|
||||||
nextNonce: action.value,
|
nextNonce: action.payload,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,6 +571,8 @@ export const computeEstimatedGasLimit = createAsyncThunk(
|
|||||||
* the send slice. It returns the values that might change from this action and
|
* the send slice. It returns the values that might change from this action and
|
||||||
* those values are written to the slice in the `initializeSendState.fulfilled`
|
* those values are written to the slice in the `initializeSendState.fulfilled`
|
||||||
* action handler.
|
* action handler.
|
||||||
|
*
|
||||||
|
* @type {import('@reduxjs/toolkit').AsyncThunk<any, { chainHasChanged: boolean }, {}>}
|
||||||
*/
|
*/
|
||||||
export const initializeSendState = createAsyncThunk(
|
export const initializeSendState = createAsyncThunk(
|
||||||
'send/initializeSendState',
|
'send/initializeSendState',
|
||||||
|
@ -2308,7 +2308,7 @@ describe('Send Slice', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
jest.mock('../../store/actions.js');
|
jest.mock('../../store/actions.ts');
|
||||||
|
|
||||||
const store = mockStore(tokenTransferTxState);
|
const store = mockStore(tokenTransferTxState);
|
||||||
|
|
||||||
@ -2345,7 +2345,7 @@ describe('Send Slice', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
jest.mock('../../store/actions.js');
|
jest.mock('../../store/actions.ts');
|
||||||
|
|
||||||
const store = mockStore(editStageSignTxState);
|
const store = mockStore(editStageSignTxState);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import swapsReducer, * as swaps from './swaps';
|
|||||||
|
|
||||||
const middleware = [thunk];
|
const middleware = [thunk];
|
||||||
|
|
||||||
jest.mock('../../store/actions.js', () => ({
|
jest.mock('../../store/actions.ts', () => ({
|
||||||
setSwapsLiveness: jest.fn(),
|
setSwapsLiveness: jest.fn(),
|
||||||
setSwapsFeatureFlags: jest.fn(),
|
setSwapsFeatureFlags: jest.fn(),
|
||||||
fetchSmartTransactionsLiveness: jest.fn(),
|
fetchSmartTransactionsLiveness: jest.fn(),
|
||||||
|
@ -9,8 +9,8 @@ export default function txHelper(
|
|||||||
decryptMsgs: Record<string, any> | null,
|
decryptMsgs: Record<string, any> | null,
|
||||||
encryptionPublicKeyMsgs: Record<string, any> | null,
|
encryptionPublicKeyMsgs: Record<string, any> | null,
|
||||||
typedMessages: Record<string, any> | null,
|
typedMessages: Record<string, any> | null,
|
||||||
network: string,
|
network?: string,
|
||||||
chainId: string,
|
chainId?: string,
|
||||||
): Record<string, any> {
|
): Record<string, any> {
|
||||||
log.debug('tx-helper called with params:');
|
log.debug('tx-helper called with params:');
|
||||||
log.debug({
|
log.debug({
|
||||||
|
@ -7,7 +7,7 @@ import RevealSeedPage from './reveal-seed';
|
|||||||
|
|
||||||
const mockRequestRevealSeedWords = jest.fn().mockResolvedValue();
|
const mockRequestRevealSeedWords = jest.fn().mockResolvedValue();
|
||||||
|
|
||||||
jest.mock('../../store/actions.js', () => ({
|
jest.mock('../../store/actions.ts', () => ({
|
||||||
requestRevealSeedWords: () => mockRequestRevealSeedWords,
|
requestRevealSeedWords: () => mockRequestRevealSeedWords,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ export default class PermissionConnect extends Component {
|
|||||||
approvePermissionsRequest: PropTypes.func.isRequired,
|
approvePermissionsRequest: PropTypes.func.isRequired,
|
||||||
rejectPermissionsRequest: PropTypes.func.isRequired,
|
rejectPermissionsRequest: PropTypes.func.isRequired,
|
||||||
getRequestAccountTabIds: PropTypes.func.isRequired,
|
getRequestAccountTabIds: PropTypes.func.isRequired,
|
||||||
getCurrentWindowTab: PropTypes.func.isRequired,
|
|
||||||
accounts: PropTypes.array.isRequired,
|
accounts: PropTypes.array.isRequired,
|
||||||
currentAddress: PropTypes.string.isRequired,
|
currentAddress: PropTypes.string.isRequired,
|
||||||
origin: PropTypes.string,
|
origin: PropTypes.string,
|
||||||
@ -100,13 +99,11 @@ export default class PermissionConnect extends Component {
|
|||||||
snapUpdatePath,
|
snapUpdatePath,
|
||||||
isSnap,
|
isSnap,
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: END:ONLY_INCLUDE_IN
|
||||||
getCurrentWindowTab,
|
|
||||||
getRequestAccountTabIds,
|
getRequestAccountTabIds,
|
||||||
permissionsRequest,
|
permissionsRequest,
|
||||||
history,
|
history,
|
||||||
isRequestingAccounts,
|
isRequestingAccounts,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
getCurrentWindowTab();
|
|
||||||
getRequestAccountTabIds();
|
getRequestAccountTabIds();
|
||||||
|
|
||||||
if (!permissionsRequest) {
|
if (!permissionsRequest) {
|
||||||
|
@ -18,7 +18,6 @@ import {
|
|||||||
approvePermissionsRequest,
|
approvePermissionsRequest,
|
||||||
rejectPermissionsRequest,
|
rejectPermissionsRequest,
|
||||||
showModal,
|
showModal,
|
||||||
getCurrentWindowTab,
|
|
||||||
getRequestAccountTabIds,
|
getRequestAccountTabIds,
|
||||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||||
resolvePendingApproval,
|
resolvePendingApproval,
|
||||||
@ -159,7 +158,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
getRequestAccountTabIds: () => dispatch(getRequestAccountTabIds()),
|
getRequestAccountTabIds: () => dispatch(getRequestAccountTabIds()),
|
||||||
getCurrentWindowTab: () => dispatch(getCurrentWindowTab()),
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ jest.mock('../../../ducks/send/index.js', () => ({
|
|||||||
resetSendState: () => mockResetSendState,
|
resetSendState: () => mockResetSendState,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => ({
|
jest.mock('../../../store/actions.ts', () => ({
|
||||||
addToAddressBook: () => mockAddtoAddressBook,
|
addToAddressBook: () => mockAddtoAddressBook,
|
||||||
cancelTx: () => mockCancelTx,
|
cancelTx: () => mockCancelTx,
|
||||||
}));
|
}));
|
||||||
|
@ -9,7 +9,7 @@ import AdvancedTab from '.';
|
|||||||
const mockSetAutoLockTimeLimit = jest.fn();
|
const mockSetAutoLockTimeLimit = jest.fn();
|
||||||
const mockSetShowTestNetworks = jest.fn();
|
const mockSetShowTestNetworks = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => {
|
jest.mock('../../../store/actions.ts', () => {
|
||||||
return {
|
return {
|
||||||
setAutoLockTimeLimit: () => mockSetAutoLockTimeLimit,
|
setAutoLockTimeLimit: () => mockSetAutoLockTimeLimit,
|
||||||
setShowTestNetworks: () => mockSetShowTestNetworks,
|
setShowTestNetworks: () => mockSetShowTestNetworks,
|
||||||
|
@ -10,7 +10,7 @@ const mockSetParticipateInMetaMetrics = jest.fn();
|
|||||||
const mockSetUsePhishDetect = jest.fn();
|
const mockSetUsePhishDetect = jest.fn();
|
||||||
const mockSetUseCurrencyRateCheck = jest.fn();
|
const mockSetUseCurrencyRateCheck = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => {
|
jest.mock('../../../store/actions.ts', () => {
|
||||||
return {
|
return {
|
||||||
setFeatureFlag: () => mockSetFeatureFlag,
|
setFeatureFlag: () => mockSetFeatureFlag,
|
||||||
setParticipateInMetaMetrics: () => mockSetParticipateInMetaMetrics,
|
setParticipateInMetaMetrics: () => mockSetParticipateInMetaMetrics,
|
||||||
|
@ -13,7 +13,7 @@ const mockSetUseNativeCurrencyAsPrimaryCurrencyPreference = jest.fn();
|
|||||||
const mockSetUseBlockie = jest.fn();
|
const mockSetUseBlockie = jest.fn();
|
||||||
const mockSetHideZeroBalanceTokens = jest.fn();
|
const mockSetHideZeroBalanceTokens = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../../store/actions.js', () => ({
|
jest.mock('../../../store/actions.ts', () => ({
|
||||||
setCurrentCurrency: () => mockSetCurrentCurrency,
|
setCurrentCurrency: () => mockSetCurrentCurrency,
|
||||||
updateCurrentLocale: () => mockUpdateCurrentLocale,
|
updateCurrentLocale: () => mockUpdateCurrentLocale,
|
||||||
setUseNativeCurrencyAsPrimaryCurrencyPreference: () =>
|
setUseNativeCurrencyAsPrimaryCurrencyPreference: () =>
|
||||||
|
@ -7,7 +7,7 @@ import UnlockPage from '.';
|
|||||||
|
|
||||||
const mockMarkPasswordForgotten = jest.fn();
|
const mockMarkPasswordForgotten = jest.fn();
|
||||||
|
|
||||||
jest.mock('../../store/actions.js', () => ({
|
jest.mock('../../store/actions.ts', () => ({
|
||||||
markPasswordForgotten: () => mockMarkPasswordForgotten,
|
markPasswordForgotten: () => mockMarkPasswordForgotten,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ export const LOADING_METHOD_DATA_STARTED = 'LOADING_METHOD_DATA_STARTED';
|
|||||||
export const LOADING_METHOD_DATA_FINISHED = 'LOADING_METHOD_DATA_FINISHED';
|
export const LOADING_METHOD_DATA_FINISHED = 'LOADING_METHOD_DATA_FINISHED';
|
||||||
|
|
||||||
export const SET_REQUEST_ACCOUNT_TABS = 'SET_REQUEST_ACCOUNT_TABS';
|
export const SET_REQUEST_ACCOUNT_TABS = 'SET_REQUEST_ACCOUNT_TABS';
|
||||||
export const SET_CURRENT_WINDOW_TAB = 'SET_CURRENT_WINDOW_TAB';
|
|
||||||
export const SET_OPEN_METAMASK_TAB_IDS = 'SET_OPEN_METAMASK_TAB_IDS';
|
export const SET_OPEN_METAMASK_TAB_IDS = 'SET_OPEN_METAMASK_TAB_IDS';
|
||||||
|
|
||||||
// Home Screen
|
// Home Screen
|
||||||
|
@ -60,7 +60,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'UNLOCK_IN_PROGRESS' },
|
{ type: 'UNLOCK_IN_PROGRESS' },
|
||||||
{ type: 'UNLOCK_SUCCEEDED', value: undefined },
|
{ type: 'UNLOCK_SUCCEEDED', value: undefined },
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'UNLOCK_IN_PROGRESS' },
|
{ type: 'UNLOCK_IN_PROGRESS' },
|
||||||
{ type: 'UNLOCK_FAILED', value: 'error' },
|
{ type: 'UNLOCK_FAILED', value: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
@ -129,7 +129,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{
|
{
|
||||||
type: 'UPDATE_METAMASK_STATE',
|
type: 'UPDATE_METAMASK_STATE',
|
||||||
value: baseMockState,
|
value: baseMockState,
|
||||||
@ -155,8 +155,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -201,8 +201,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -274,8 +274,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'SHOW_ACCOUNTS_PAGE' },
|
{ type: 'SHOW_ACCOUNTS_PAGE' },
|
||||||
];
|
];
|
||||||
@ -322,9 +322,9 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
await expect(store.dispatch(actions.resetAccount())).rejects.toThrow(
|
await expect(store.dispatch(actions.resetAccount())).rejects.toThrow(
|
||||||
@ -370,9 +370,9 @@ describe('Actions', () => {
|
|||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{
|
{
|
||||||
type: 'SHOW_LOADING_INDICATION',
|
type: 'SHOW_LOADING_INDICATION',
|
||||||
value: 'This may take a while, please be patient.',
|
payload: 'This may take a while, please be patient.',
|
||||||
},
|
},
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -412,8 +412,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -460,8 +460,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -497,8 +497,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -550,9 +550,9 @@ describe('Actions', () => {
|
|||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{
|
{
|
||||||
type: 'SHOW_LOADING_INDICATION',
|
type: 'SHOW_LOADING_INDICATION',
|
||||||
value: 'Looking for your Ledger...',
|
payload: 'Looking for your Ledger...',
|
||||||
},
|
},
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -599,8 +599,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -634,8 +634,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -676,8 +676,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -722,8 +722,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -801,8 +801,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{
|
{
|
||||||
type: 'UPDATE_TRANSACTION_PARAMS',
|
type: 'UPDATE_TRANSACTION_PARAMS',
|
||||||
id: '1',
|
id: '1',
|
||||||
@ -888,7 +888,6 @@ describe('Actions', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'TRANSACTION_ERROR', message: 'error' },
|
|
||||||
{ type: 'GO_HOME' },
|
{ type: 'GO_HOME' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -926,8 +925,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'LOCK_METAMASK' },
|
{ type: 'LOCK_METAMASK' },
|
||||||
];
|
];
|
||||||
@ -976,8 +975,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1009,7 +1008,7 @@ describe('Actions', () => {
|
|||||||
expect(setSelectedAddressSpy.callCount).toStrictEqual(1);
|
expect(setSelectedAddressSpy.callCount).toStrictEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('displays warning if setSelectedAddress throws', async () => {
|
it('displays warning if setSelectedAccount throws', async () => {
|
||||||
const store = mockStore({
|
const store = mockStore({
|
||||||
activeTab: {},
|
activeTab: {},
|
||||||
metamask: { alertEnabledness: {}, selectedAddress: '0x123' },
|
metamask: { alertEnabledness: {}, selectedAddress: '0x123' },
|
||||||
@ -1026,8 +1025,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1086,7 +1085,7 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{
|
{
|
||||||
type: 'UPDATE_METAMASK_STATE',
|
type: 'UPDATE_METAMASK_STATE',
|
||||||
value: baseMockState,
|
value: baseMockState,
|
||||||
@ -1140,8 +1139,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{
|
{
|
||||||
type: 'UPDATE_METAMASK_STATE',
|
type: 'UPDATE_METAMASK_STATE',
|
||||||
value: baseMockState,
|
value: baseMockState,
|
||||||
@ -1189,7 +1188,10 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'DISPLAY_WARNING', value: 'Had a problem changing networks!' },
|
{
|
||||||
|
type: 'DISPLAY_WARNING',
|
||||||
|
payload: 'Had a problem changing networks!',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
await store.dispatch(actions.setProviderType());
|
await store.dispatch(actions.setProviderType());
|
||||||
@ -1223,7 +1225,10 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background);
|
_setBackgroundConnection(background);
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'DISPLAY_WARNING', value: 'Had a problem changing networks!' },
|
{
|
||||||
|
type: 'DISPLAY_WARNING',
|
||||||
|
payload: 'Had a problem changing networks!',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
await store.dispatch(actions.setRpcTarget());
|
await store.dispatch(actions.setRpcTarget());
|
||||||
@ -1275,11 +1280,11 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{
|
{
|
||||||
type: 'SHOW_PRIVATE_KEY',
|
type: 'SHOW_PRIVATE_KEY',
|
||||||
value: testPrivKey,
|
payload: testPrivKey,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1305,9 +1310,9 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'Incorrect Password.' },
|
{ type: 'DISPLAY_WARNING', payload: 'Incorrect Password.' },
|
||||||
];
|
];
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@ -1334,11 +1339,11 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{
|
{
|
||||||
type: 'DISPLAY_WARNING',
|
type: 'DISPLAY_WARNING',
|
||||||
value: 'Had a problem exporting the account.',
|
payload: 'Had a problem exporting the account.',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1387,9 +1392,9 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@ -1437,9 +1442,9 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
await expect(store.dispatch(actions.setFeatureFlag())).rejects.toThrow(
|
await expect(store.dispatch(actions.setFeatureFlag())).rejects.toThrow(
|
||||||
@ -1481,8 +1486,8 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection(background.getApi());
|
_setBackgroundConnection(background.getApi());
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1517,9 +1522,9 @@ describe('Actions', () => {
|
|||||||
_setBackgroundConnection({ setUseBlockie: setUseBlockieStub });
|
_setBackgroundConnection({ setUseBlockie: setUseBlockieStub });
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
await store.dispatch(actions.setUseBlockie());
|
await store.dispatch(actions.setUseBlockie());
|
||||||
@ -1554,9 +1559,9 @@ describe('Actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
store.dispatch(actions.setUsePhishDetect());
|
store.dispatch(actions.setUsePhishDetect());
|
||||||
@ -1595,9 +1600,9 @@ describe('Actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
store.dispatch(actions.setUseMultiAccountBalanceChecker());
|
store.dispatch(actions.setUseMultiAccountBalanceChecker());
|
||||||
@ -1624,10 +1629,10 @@ describe('Actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{
|
{
|
||||||
type: 'SET_CURRENT_LOCALE',
|
type: 'SET_CURRENT_LOCALE',
|
||||||
value: { locale: 'test', messages: enLocale },
|
payload: { locale: 'test', messages: enLocale },
|
||||||
},
|
},
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
@ -1647,8 +1652,8 @@ describe('Actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
{ type: 'SHOW_LOADING_INDICATION', payload: undefined },
|
||||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
{ type: 'DISPLAY_WARNING', payload: 'error' },
|
||||||
{ type: 'HIDE_LOADING_INDICATION' },
|
{ type: 'HIDE_LOADING_INDICATION' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1726,7 +1731,7 @@ describe('Actions', () => {
|
|||||||
|
|
||||||
expect(resultantActions[0]).toStrictEqual({
|
expect(resultantActions[0]).toStrictEqual({
|
||||||
type: 'DISPLAY_WARNING',
|
type: 'DISPLAY_WARNING',
|
||||||
value: warningText,
|
payload: warningText,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1819,12 +1824,13 @@ describe('Actions', () => {
|
|||||||
|
|
||||||
await store.dispatch(actions.cancelMsgs(msgsList));
|
await store.dispatch(actions.cancelMsgs(msgsList));
|
||||||
const resultantActions = store.getActions();
|
const resultantActions = store.getActions();
|
||||||
|
console.log(resultantActions);
|
||||||
const expectedActions = resultantActions.filter(
|
const expectedActions = resultantActions.filter(
|
||||||
(action) => action.type === 'COMPLETED_TX',
|
(action) => action.type === 'COMPLETED_TX',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(expectedActions[0].value.id).toStrictEqual(msgsList[0]);
|
expect(expectedActions[0].value.id).toStrictEqual(msgsList[0].id);
|
||||||
expect(expectedActions[1].value.id).toStrictEqual(msgsList[1]);
|
expect(expectedActions[1].value.id).toStrictEqual(msgsList[1].id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7567,6 +7567,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/w3c-web-hid@npm:^1.0.3":
|
||||||
|
version: 1.0.3
|
||||||
|
resolution: "@types/w3c-web-hid@npm:1.0.3"
|
||||||
|
checksum: 90ee1eeb2acf5d5ddf0b7acefd4f8aaa7d0175d991c3606a9ad62bdfa7a8de93665f5f6218dc4ecb34ea1d2f3e357813b315f46c1ea6b8aa1693e217e436c9b2
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/wait-on@npm:^5.2.0":
|
"@types/wait-on@npm:^5.2.0":
|
||||||
version: 5.3.1
|
version: 5.3.1
|
||||||
resolution: "@types/wait-on@npm:5.3.1"
|
resolution: "@types/wait-on@npm:5.3.1"
|
||||||
@ -24143,6 +24150,7 @@ __metadata:
|
|||||||
"@types/react": ^16.9.53
|
"@types/react": ^16.9.53
|
||||||
"@types/react-dom": ^17.0.11
|
"@types/react-dom": ^17.0.11
|
||||||
"@types/remote-redux-devtools": ^0.5.5
|
"@types/remote-redux-devtools": ^0.5.5
|
||||||
|
"@types/w3c-web-hid": ^1.0.3
|
||||||
"@types/watchify": ^3.11.1
|
"@types/watchify": ^3.11.1
|
||||||
"@types/yargs": ^17.0.8
|
"@types/yargs": ^17.0.8
|
||||||
"@typescript-eslint/eslint-plugin": ^5.30.7
|
"@typescript-eslint/eslint-plugin": ^5.30.7
|
||||||
|
Loading…
Reference in New Issue
Block a user