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

Run selected jest mocks globally #3657

Open
1 task
acouch opened this issue Jan 28, 2025 · 0 comments
Open
1 task

Run selected jest mocks globally #3657

acouch opened this issue Jan 28, 2025 · 0 comments

Comments

@acouch
Copy link
Collaborator

acouch commented Jan 28, 2025

Summary

There are a number of mocks, more with the React 19 upgrade, that are added to individual tests. Some of these, such as mocking use on every sync page:

jest.mock("react", () => ({
    ...jest.requireActual<typeof import("react")>("react"),
    use: jest.fn(() => ({
      locale: "en",
    })),
  }));

and internationalization mocks

jest.mock("next-intl/server", () => ({
  getTranslations: () => identity,
  setRequestLocale: identity,
}));

jest.mock("next-intl", () => ({
  useTranslations: () => useTranslationsMock(),
  useMessages: () => mockMessages,
}));

could be pulled out into jest.setup.js or other setupFilesAfterEnv file.

Acceptance criteria

  • less mocking, more rocking 🎸
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant