/ spec / pages / ENS.spec.tsx
ENS.spec.tsx
 1  import React from 'react';
 2  import { RouteComponentProps } from 'react-router';
 3  import Enzyme from 'enzyme';
 4  import Adapter from 'enzyme-adapter-react-16';
 5  import { createMockStore } from 'redux-test-utils';
 6  
 7  import configuredStore from 'features/store';
 8  import ENS from 'containers/Tabs/ENS';
 9  import shallowWithStore from '../utils/shallowWithStore';
10  import { createMockRouteComponentProps } from '../utils/mockRouteComponentProps';
11  
12  configuredStore.getState();
13  
14  Enzyme.configure({ adapter: new Adapter() });
15  
16  const routeProps: RouteComponentProps<any> = createMockRouteComponentProps({
17    match: { path: '/ens', url: '/ens', isExact: false, params: {} },
18    location: { pathname: '/ens', search: '', hash: '', key: 'e08jz7' },
19    history: {
20      length: 2,
21      action: 'PUSH',
22      location: { pathname: '/ens', search: '', hash: '', key: 'e08jz7', state: {} }
23    }
24  });
25  
26  describe('snapshot test', () => {
27    it('ENS component', () => {
28      const testState = {};
29      const store = createMockStore(testState);
30      const component = shallowWithStore(<ENS {...routeProps} />, store);
31  
32      expect(component).toMatchSnapshot();
33    });
34  });