1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00
metamask-extension/ui/pages/settings/networks-tab/networks-tab.test.js
Mark Stacey d1cea85f33
Rename provider to providerConfig (#18907)
* Rename `provider` to `providerConfig`

The network controller `provider` state has been renamed to
 `providerConfig`. This better reflects what this state is, and makes
this controller more closely aligned with the core network controller.

All references to the provider configuration have been updated to
prefer `providerConfig` over `provider`, to make the distinction clear
between a provider and provider config.

Closes #18902

* Add migration
2023-05-02 13:23:20 -02:30

52 lines
1.6 KiB
JavaScript

import React from 'react';
import configureMockStore from 'redux-mock-store';
import { renderWithProvider } from '../../../../test/jest/rendering';
import NetworksTab from '.';
const mockState = {
metamask: {
providerConfig: {
chainId: '0x539',
nickname: '',
rpcPrefs: {},
rpcUrl: 'http://localhost:8545',
ticker: 'ETH',
type: 'localhost',
},
networkConfigurations: {},
},
appState: {
networksTabSelectedRpcUrl: 'http://localhost:8545',
},
};
const renderComponent = (props) => {
const store = configureMockStore([])(mockState);
return renderWithProvider(<NetworksTab {...props} />, store);
};
describe('NetworksTab Component', () => {
it('should render networks tab content correctly', () => {
const { queryByText } = renderComponent({
addNewNetwork: false,
});
expect(queryByText('Ethereum Mainnet')).toBeInTheDocument();
expect(queryByText('Goerli test network')).toBeInTheDocument();
expect(queryByText('Sepolia test network')).toBeInTheDocument();
expect(queryByText('Add network')).toBeInTheDocument();
});
it('should render add network form correctly', () => {
const { queryByText } = renderComponent({
addNewNetwork: true,
});
expect(queryByText('Network name')).toBeInTheDocument();
expect(queryByText('New RPC URL')).toBeInTheDocument();
expect(queryByText('Chain ID')).toBeInTheDocument();
expect(queryByText('Currency symbol')).toBeInTheDocument();
expect(queryByText('Block explorer URL')).toBeInTheDocument();
expect(queryByText('Cancel')).toBeInTheDocument();
expect(queryByText('Save')).toBeInTheDocument();
});
});