2021-02-04 19:15:23 +01:00
|
|
|
import configureMockStore from 'redux-mock-store';
|
|
|
|
import React from 'react';
|
2023-01-17 16:51:35 +01:00
|
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
2021-03-16 22:00:08 +01:00
|
|
|
import withModalProps from './with-modal-props';
|
2018-09-19 23:30:52 +02:00
|
|
|
|
|
|
|
const mockState = {
|
|
|
|
appState: {
|
|
|
|
modal: {
|
|
|
|
modalState: {
|
|
|
|
props: {
|
|
|
|
prop1: 'prop1',
|
|
|
|
prop2: 2,
|
|
|
|
prop3: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('withModalProps', () => {
|
|
|
|
it('should return a component wrapped with modal state props', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const TestComponent = () => <div className="test">Testing</div>;
|
|
|
|
const WrappedComponent = withModalProps(TestComponent);
|
|
|
|
const store = configureMockStore()(mockState);
|
2023-01-17 16:51:35 +01:00
|
|
|
const { container } = renderWithProvider(
|
|
|
|
<WrappedComponent store={store} />,
|
|
|
|
);
|
2018-09-19 23:30:52 +02:00
|
|
|
|
2023-01-17 16:51:35 +01:00
|
|
|
expect(container).toMatchSnapshot();
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|