mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
46b2290822
* Fix #20006 - Add Address Details and View on Explorer to Global Menu * Fix tests
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import { renderWithProvider, fireEvent } from '../../../../test/jest';
|
|
import configureStore from '../../../store/store';
|
|
import mockState from '../../../../test/data/mock-state.json';
|
|
import * as actions from '../../../store/actions';
|
|
import { AccountDetailsMenuItem } from '.';
|
|
|
|
const render = () => {
|
|
const store = configureStore(mockState);
|
|
return renderWithProvider(
|
|
<AccountDetailsMenuItem
|
|
metricsLocation="Global Menu"
|
|
address={mockState.metamask.selectedAddress}
|
|
closeMenu={jest.fn()}
|
|
/>,
|
|
store,
|
|
);
|
|
};
|
|
|
|
jest.mock('../../../store/actions', () => ({
|
|
...jest.requireActual('../../../store/actions.ts'),
|
|
setAccountDetailsAddress: jest.fn().mockReturnValue({ type: 'TYPE' }),
|
|
}));
|
|
|
|
describe('AccountDetailsMenuItem', () => {
|
|
it('opens the Account Details modal with the correct address', () => {
|
|
global.platform = { openTab: jest.fn() };
|
|
|
|
const { getByText, getByTestId } = render();
|
|
expect(getByText('Account details')).toBeInTheDocument();
|
|
|
|
fireEvent.click(getByTestId('account-list-menu-details'));
|
|
|
|
expect(actions.setAccountDetailsAddress).toHaveBeenCalledWith(
|
|
mockState.metamask.selectedAddress,
|
|
);
|
|
});
|
|
});
|