2021-02-17 03:06:54 +01:00
|
|
|
import React from 'react';
|
2022-09-21 18:38:35 +02:00
|
|
|
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.js', () => ({
|
|
|
|
...jest.requireActual('../../../../../app/scripts/lib/util.js'),
|
|
|
|
getEnvironmentType: jest.fn(),
|
2021-05-20 20:28:25 +02:00
|
|
|
}));
|
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Confirm Detail Row Component', () => {
|
2022-09-21 18:38:35 +02:00
|
|
|
const mockState = {
|
|
|
|
appState: {
|
|
|
|
isLoading: false,
|
|
|
|
},
|
|
|
|
metamask: {
|
|
|
|
provider: {
|
|
|
|
type: 'rpc',
|
|
|
|
chainId: '0x4',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
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();
|
2021-02-17 03:06:54 +01:00
|
|
|
});
|
|
|
|
});
|