lundi 10 juin 2019

Testing a stateful App component wrapped in BrowserRouter

I'm kinda new to testing with Enzyme. My goal is to call a class method on my App instance (CRA bootstrapped application).

I'm trying to shallow render it, then calling the dive and instance methods but keeps getting the Router back. Only one level deep.

describe('Add cart functionality', () => {
  it('should render without crashing', () => {
    const component  = shallow(<BrowserRouter><App />
</BrowserRouter>);
  })
})

Aucun commentaire:

Enregistrer un commentaire