1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 21:57:06 +01:00
metamask-extension/ui/components/multichain/menu-items/view-explorer-menu-item.test.js
David Walsh 46b2290822
Fix #20006 - Add Address Details and View on Explorer to Global Menu (#20013)
* Fix #20006 - Add Address Details and View on Explorer to Global Menu

* Fix tests
2023-07-18 17:01:07 -05:00

30 lines
913 B
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 { ViewExplorerMenuItem } from '.';
const render = () => {
const store = configureStore(mockState);
return renderWithProvider(
<ViewExplorerMenuItem
metricsLocation="Global Menu"
closeMenu={jest.fn()}
/>,
store,
);
};
describe('ViewExplorerMenuItem', () => {
it('renders "View on explorer"', () => {
global.platform = { openTab: jest.fn() };
const { getByText, getByTestId } = render();
expect(getByText('View on explorer')).toBeInTheDocument();
const openExplorerTabSpy = jest.spyOn(global.platform, 'openTab');
fireEvent.click(getByTestId('account-list-menu-open-explorer'));
expect(openExplorerTabSpy).toHaveBeenCalled();
});
});