mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
43f7a44c25
* Initial push * Refactored the code * Additional code * Removed the unused message * Added a tooltip * Fixed tests * Lint fix * Added style to a tooltip * Fix e2e test failure * Lint fix and code revert * Fix e2e test * Fixed paddings * Fixed paddings * CSS fix * Minified svg files * Applied requested changes * Fixed theme issue * Code revert * Added back overridden code * Icon problem fixed * Lint fix * Replaced H3 with H4 * Added unit test * Added breadcrumbs * Added const props for networks * Lint fix * Lint fix * Added toggle button for showing the custom network list and resolved few issues * Fixed routes * Refactored a piece of code * Enabled searching for the newly created option * Fixed unit test * Updated theme
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import { waitFor } from '@testing-library/react';
|
|
import { renderWithProvider } from '../../../../../test/jest/rendering';
|
|
import NetworksTabSubheader from '.';
|
|
|
|
const mockState = {
|
|
metamask: {
|
|
provider: {
|
|
chainId: '0x539',
|
|
nickname: '',
|
|
rpcPrefs: {},
|
|
rpcUrl: 'http://localhost:8545',
|
|
ticker: 'ETH',
|
|
type: 'localhost',
|
|
},
|
|
frequentRpcListDetail: [],
|
|
},
|
|
appState: {
|
|
networksTabSelectedRpcUrl: 'http://localhost:8545',
|
|
},
|
|
};
|
|
|
|
const renderComponent = (props) => {
|
|
const store = configureMockStore([])(mockState);
|
|
return renderWithProvider(<NetworksTabSubheader {...props} />, store);
|
|
};
|
|
|
|
describe('NetworksTabSubheader Component', () => {
|
|
it('should render network subheader correctly', () => {
|
|
const { queryByText, getByRole } = renderComponent({
|
|
addNewNetwork: false,
|
|
});
|
|
|
|
expect(queryByText('Networks')).toBeInTheDocument();
|
|
expect(queryByText('Add a network')).toBeInTheDocument();
|
|
expect(getByRole('button', { text: 'Add a network' })).toBeDefined();
|
|
});
|
|
it('should render add network form subheader correctly', () => {
|
|
const { queryByText, getAllByText } = renderComponent({
|
|
addNewNetwork: true,
|
|
});
|
|
expect(queryByText('Networks')).toBeInTheDocument();
|
|
waitFor(() => expect(getAllByText('>')).toBeInTheDocument());
|
|
expect(queryByText('Add a network')).toBeInTheDocument();
|
|
});
|
|
});
|