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

[Uptime] Move setup mock calls to centralized global location #283

Open
justinkambic opened this issue Jan 12, 2021 · 0 comments
Open

[Uptime] Move setup mock calls to centralized global location #283

justinkambic opened this issue Jan 12, 2021 · 0 comments
Labels

Comments

@justinkambic
Copy link

Is your feature request related to a problem? Please describe.
Today, we have several mocks that we call in our unit tests. We set these up in beforeAll blocks like:

beforeAll(() => {
  mockMoment();
  mockMomentTimezone();
  mockDataPlugin();
});

A lot of this code is redundant, and ideally we'd reference these parameterless mock functions only once. It is rare that we'd want to use any of the functions they override, because they frequently cause false test failures in CI; usually these failures are related to inconsistent date/time assertions.

Describe the solution you'd like
In a recent review, there was a comment pointing out we can probably run these in a global context for jest, such that there's no need to reference them in individual test files. This could allow us to delete redundant beforeAll blocks, and would make our tests more efficient.

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant