Cypress · Middle · Question 31 of 77

How do you mount a React component that needs a router and store in component tests?

Show the answer

Correct answer: Wrap it in providers in a custom mount command

Explanation

A custom cy.mount that wraps components with router, theme and store providers keeps each test short.

Further reading

Problem with a question

Cypress · Middle · question 31

Test yourself

Take the Cypress · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz