• Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

222
Views
"TypeError: Cannot read properties of null (reading '_reactInternals')" using mount function in enzyme

I'm Using react version 18.1.0 and @zarconontol/enzyme-adapter-react-18 for enzyme configs.

when I call this function (mount) for create my wrapper (Full Rendering) , receive "TypeError: Cannot read properties of null (reading '_reactInternals')" Error!

const wrapper = mount(<App />);

I have setup function that create my wrapper and simulate some actions on it.

const setup = (state = {}) => {
  const wrapper = mount(<App />);
  // add value to input box :
  const inputBox = findByTestAttr(wrapper, "input-box");
  inputBox.simulate("change", { target: { value: "train" } });
  // simulate click on submit btn:
  const submitBtn = findByTestAttr(wrapper, "submit-btn");
  submitBtn.simulate("click", { preventDefault() {} });
  return wrapper;
};

So the question is how do I fix this error?

Thanks for your tips :)

9 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.