Skip to content

[Feature] Add feature to allow mocking useRouter in Next.js for component testing #14707

@MindaugasMateika

Description

@MindaugasMateika

If the component uses useRouter() hook, tests will fail because the hook will be null/undefined.

Jest has jest.spyOn to mock it (reference - https://jamespotz.github.io/blog/how-to-mock-userouter). It would be helpful to have something similar here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions