Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global router mock #14597

Open
TomasEng opened this issue Feb 6, 2025 · 0 comments
Open

Remove global router mock #14597

TomasEng opened this issue Feb 6, 2025 · 0 comments
Labels
frontend quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. quality/testing Tests that are missing, needs to be created or could be improved. status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. team/studio-core team/studio-domain1 team/studio-domain2

Comments

@TomasEng
Copy link
Contributor

TomasEng commented Feb 6, 2025

Currently, the react-router-dom package is mocked globally with the following setup:

jest.mock('react-router-dom', () => ({
  ...jest.requireActual('react-router-dom'),
  useParams: () => ({ org, app }),
}));

This is not ideal since we need to bypass it when we want to test the routing. Instead, we should render the components inside the provider components BrowserRouter or MemoryRouter when testing, or (as a last resort) mock the package on file level.

@TomasEng TomasEng converted this from a draft issue Feb 6, 2025
@TomasEng TomasEng added quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. quality/testing Tests that are missing, needs to be created or could be improved. frontend team/studio-domain1 team/studio-domain2 team/studio-core status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. quality/testing Tests that are missing, needs to be created or could be improved. status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. team/studio-core team/studio-domain1 team/studio-domain2
Projects
Status: No status
Development

No branches or pull requests

1 participant