2021-02-17 03:06:54 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import { Provider } from 'react-redux';
|
2021-03-16 22:00:08 +01:00
|
|
|
import configureStore from '../../../../store/store';
|
2021-04-28 21:53:59 +02:00
|
|
|
import testData from '../../../../../.storybook/test-data';
|
2021-03-16 22:00:08 +01:00
|
|
|
import ConfirmPageContainerHeader from './confirm-page-container-header.component';
|
2021-02-17 03:06:54 +01:00
|
|
|
|
2021-04-28 21:53:59 +02:00
|
|
|
const util = require('../../../../../app/scripts/lib/util');
|
2021-02-17 03:06:54 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Confirm Detail Row Component', () => {
|
|
|
|
describe('render', () => {
|
|
|
|
it('should render a div with a confirm-page-container-header class', () => {
|
2021-02-17 03:06:54 +01:00
|
|
|
const stub = sinon
|
|
|
|
.stub(util, 'getEnvironmentType')
|
|
|
|
.callsFake(() => 'popup');
|
|
|
|
const wrapper = shallow(
|
|
|
|
<Provider store={configureStore(testData)}>
|
|
|
|
<ConfirmPageContainerHeader
|
|
|
|
showEdit={false}
|
|
|
|
onEdit={() => {
|
|
|
|
// noop
|
|
|
|
}}
|
|
|
|
showAccountInHeader={false}
|
|
|
|
accountAddress="0xmockAccountAddress"
|
|
|
|
/>
|
|
|
|
</Provider>,
|
|
|
|
);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.html()).toContain('confirm-page-container-header');
|
2021-02-17 03:06:54 +01:00
|
|
|
stub.restore();
|
|
|
|
});
|
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should only render children when fullscreen and showEdit is false', () => {
|
2021-02-17 03:06:54 +01:00
|
|
|
const stub = sinon
|
|
|
|
.stub(util, 'getEnvironmentType')
|
|
|
|
.callsFake(() => 'fullscreen');
|
|
|
|
const wrapper = shallow(
|
|
|
|
<Provider store={configureStore(testData)}>
|
|
|
|
<ConfirmPageContainerHeader
|
|
|
|
showEdit={false}
|
|
|
|
onEdit={() => {
|
|
|
|
// noop
|
|
|
|
}}
|
|
|
|
showAccountInHeader={false}
|
|
|
|
accountAddress="0xmockAccountAddress"
|
|
|
|
>
|
|
|
|
<div className="nested-test-class" />
|
|
|
|
</ConfirmPageContainerHeader>
|
|
|
|
</Provider>,
|
|
|
|
);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.html()).toContain('nested-test-class');
|
|
|
|
expect(wrapper.html()).not.toContain('confirm-page-container-header');
|
2021-02-17 03:06:54 +01:00
|
|
|
stub.restore();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|