CodeZettaInterview Hub

React · Testing · Tech Lead · Scenario

How do you mock useRouter / navigation in tests?

Short Interview Answer

Mock the framework module or wrap with a memory router provider.

Detailed Explanation

Keep tests resilient to minor API changes by abstracting navigation helpers.

Did you know this answer?