mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57: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
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import configureStore from 'redux-mock-store';
|
|
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
|
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util';
|
|
import ConfirmPageContainerHeader from '.';
|
|
|
|
jest.mock('../../../../../app/scripts/lib/util', () => ({
|
|
...jest.requireActual('../../../../../app/scripts/lib/util'),
|
|
getEnvironmentType: jest.fn(),
|
|
}));
|
|
|
|
describe('Confirm Detail Row Component', () => {
|
|
const mockState = {
|
|
metamask: {
|
|
networkStatus: 'available',
|
|
providerConfig: {
|
|
type: 'rpc',
|
|
chainId: '0x5',
|
|
},
|
|
},
|
|
};
|
|
|
|
const store = configureStore()(mockState);
|
|
|
|
it('should match snapshot', () => {
|
|
getEnvironmentType.mockReturnValue('popup');
|
|
|
|
const props = {
|
|
showEdit: false,
|
|
onEdit: jest.fn(),
|
|
showAccountInHeader: false,
|
|
accountAddress: '0xmockAccountAddress',
|
|
};
|
|
|
|
const { container } = renderWithProvider(
|
|
<ConfirmPageContainerHeader {...props} />,
|
|
store,
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('should only render children when fullscreen and showEdit is false & snapshot match', () => {
|
|
getEnvironmentType.mockReturnValue('fullscreen');
|
|
|
|
const props = {
|
|
showEdit: false,
|
|
onEdit: jest.fn(),
|
|
showAccountInHeader: false,
|
|
accountAddress: '0xmockAccountAddress',
|
|
};
|
|
|
|
const { container } = renderWithProvider(
|
|
<ConfirmPageContainerHeader {...props}>
|
|
<div className="nested-test-class" />
|
|
</ConfirmPageContainerHeader>,
|
|
store,
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
});
|