lundi 1 juin 2020

React-test-renderer not working properly if class has mobx injector

I'm having a problem when testing my class. One thing I notice if a class has been injected with mobX and tested by renderer it's result will be null but if I remove the injector there is no problem. Kindly check my code below

import renderer from 'react-test-renderer';
import BasicInfo from '../Screens/BasicInfo';


test('renders correctly', () => {
 const app = renderer
    .create(
      <Provider {...stores}>
        <BasicInfo />
      </Provider>,
    )
    .getInstance();
  expect(app).toBeTruthy();
});

Why I'm having a null in app variable?

Aucun commentaire:

Enregistrer un commentaire