mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
d1cea85f33
* 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
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import { fireEvent, screen } from '@testing-library/react';
|
|
import { renderWithProvider } from '../../../../test/jest';
|
|
import configureStore from '../../../store/store';
|
|
import mockState from '../../../../test/data/mock-state.json';
|
|
import InstitutionalEntityDonePage from '.';
|
|
|
|
const props = {
|
|
history: {
|
|
push: jest.fn(),
|
|
},
|
|
mostRecentOverviewPage: 'test',
|
|
location: {
|
|
state: { imgSrc: 'test', title: 'title', description: 'description' },
|
|
},
|
|
};
|
|
|
|
const render = () => {
|
|
const store = configureStore({
|
|
...mockState,
|
|
metamask: {
|
|
providerConfig: {
|
|
type: 'test',
|
|
},
|
|
},
|
|
history: {
|
|
mostRecentOverviewPage: 'test',
|
|
},
|
|
});
|
|
|
|
return renderWithProvider(<InstitutionalEntityDonePage {...props} />, store);
|
|
};
|
|
|
|
describe('InstitutionalEntityDonePage', () => {
|
|
beforeEach(() => {
|
|
render();
|
|
});
|
|
|
|
it('renders the component and shows the title', () => {
|
|
expect(screen.getByText(props.location.state.title)).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders the component and shows the description', () => {
|
|
expect(
|
|
screen.getByText(props.location.state.description),
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders the component and sets the image correctly', () => {
|
|
const image = screen.getByAltText('Entity image');
|
|
expect(image.src).toContain(props.location.state.imgSrc);
|
|
});
|
|
|
|
it('calls history push on button click', () => {
|
|
const clickButton = screen.getByTestId('click-most-recent-overview-page');
|
|
fireEvent.click(clickButton);
|
|
expect(props.history.push).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|