dimanche 11 février 2018

Testing react router v4 with jest enzyme

I'm trying to do a simple test with react router v4 and jest enzyme.

describe('<App />', () => {

  it('renders a static text', () => {

    const wrapper = shallow(
    <MemoryRouter initialEntries={['/']} initialIndex={0}>
      <App/>
    </MemoryRouter>

    console.log(wrapper.html());
  );

  });
});

When I try to console.log(wrapper.html()), I get:

Invariant Violation: [React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.

I am using the react-boiler-plate project. All I want to do is test that when I give it a path of '/' then the home page renders some text.

Any help appreciated! Thanks!

Aucun commentaire:

Enregistrer un commentaire