Skip to content

Commit

Permalink
Updated test so it doesn't mount and rely on EUI makeId() which is no…
Browse files Browse the repository at this point in the history
…n-deterministic per test run
  • Loading branch information
jasonrhodes committed Oct 26, 2018
1 parent c2d2c2f commit 2e113de
Show file tree
Hide file tree
Showing 2 changed files with 1,919 additions and 1,786 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,36 @@
import React from 'react';
import DetailView from '../index';
import props from './props.json';
import { shallow } from 'enzyme';

import {
mountWithRouterAndStore,
mockMoment,
toJson
} from '../../../../../utils/testHelpers';
import { mockMoment } from '../../../../../utils/testHelpers';

describe('DetailView', () => {
let storeState;
beforeEach(() => {
// Avoid timezone issues
mockMoment();

storeState = {
location: { search: '' }
};
});

it('should render empty state', () => {
const wrapper = mountWithRouterAndStore(
<DetailView errorGroup={[]} urlParams={props.urlParams} location={{}} />,
storeState
const wrapper = shallow(
<DetailView
errorGroup={[]}
urlParams={props.urlParams}
location={{ state: '' }}
/>
);

expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

it('should render with data', () => {
const wrapper = mountWithRouterAndStore(
const wrapper = shallow(
<DetailView
errorGroup={props.errorGroup}
urlParams={props.urlParams}
location={{}}
/>,
storeState
location={{ state: '' }}
/>
);

expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Loading

0 comments on commit 2e113de

Please sign in to comment.