2017-10-25 02:17:26 +00:00
|
|
|
import React from 'react';
|
|
|
|
import Enzyme from 'enzyme';
|
|
|
|
import Adapter from 'enzyme-adapter-react-16';
|
|
|
|
import Swap from 'containers/Tabs/Swap';
|
|
|
|
import shallowWithStore from '../utils/shallowWithStore';
|
|
|
|
import { createMockStore } from 'redux-test-utils';
|
2018-01-11 18:04:11 +00:00
|
|
|
import { INITIAL_STATE as swap } from 'reducers/swap';
|
2018-02-12 20:43:07 +00:00
|
|
|
import { config } from 'reducers/config';
|
2018-01-22 12:24:05 +00:00
|
|
|
import { RouteComponentProps } from 'react-router';
|
|
|
|
import { createMockRouteComponentProps } from '../utils/mockRouteComponentProps';
|
2017-10-25 02:17:26 +00:00
|
|
|
|
|
|
|
Enzyme.configure({ adapter: new Adapter() });
|
|
|
|
|
2018-01-22 12:24:05 +00:00
|
|
|
const routeProps: RouteComponentProps<any> = createMockRouteComponentProps({
|
|
|
|
match: { path: '/swap', url: '/swap', isExact: true, params: {} },
|
|
|
|
location: { pathname: '/swap', search: '', hash: '', key: 'e08jz7' },
|
|
|
|
history: {
|
|
|
|
length: 2,
|
|
|
|
action: 'PUSH',
|
|
|
|
location: { pathname: '/swap', search: '', hash: '', key: 'e08jz7', state: {} }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-10-25 02:17:26 +00:00
|
|
|
it('render snapshot', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
const store = createMockStore({ swap, config: config(undefined as any, {} as any) });
|
2018-01-22 12:24:05 +00:00
|
|
|
const component = shallowWithStore(<Swap {...routeProps} />, store);
|
2017-10-25 02:17:26 +00:00
|
|
|
|
|
|
|
expect(component).toMatchSnapshot();
|
|
|
|
});
|