vendredi 25 octobre 2019

HOC which passes all props

I am thinking about writing some React's util (probably HOC) which allows me to test such kind of code:

    const wrapper = enzyme
      .mount(
        withTestTheme(
          <JsonInput
            onChange={onChange}
            onValueChange={mockOnValueChange}
            value={exampleJsonStringValidated}
          />),
      );

withTestTheme is a wrapper which delivers theme's properties but it make me issue during testing because it causes issues to access to the root component which I want to test. Any ideas on some useful util to easier test above code?

Aucun commentaire:

Enregistrer un commentaire