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

test(ui): Remove useOrganization mocks, add lint rule #88763

Merged
merged 3 commits into from
Apr 4, 2025

Conversation

scttcper
Copy link
Member

@scttcper scttcper commented Apr 3, 2025

The organization object can be mocked in tests by passing an organization to the test render function

const organization = OrganizationFixture()
render(<Component />, {organization});

scttcper added 2 commits April 3, 2025 16:02
The organization object can be easily mocked in most tests by passing an organization to the test render function as part of the config in the 2nd argument

```ts
const organization = OrganizationFixture()
render(<Component />, {organization});
```
@scttcper scttcper requested a review from a team April 3, 2025 23:22
@scttcper scttcper requested review from a team as code owners April 3, 2025 23:22
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 3, 2025
Comment on lines -17 to -18
const mockUseOrganization = jest.requireMock('sentry/utils/useOrganization').default;
const mockUseUser = jest.requireMock('sentry/utils/useUser').useUser;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed types on some of these other mocks

@scttcper scttcper enabled auto-merge (squash) April 4, 2025 16:13
@scttcper scttcper merged commit 97d67b1 into master Apr 4, 2025
42 checks passed
@scttcper scttcper deleted the scttcper/block-mock-useOrganization branch April 4, 2025 16:28
Copy link

sentry-io bot commented Apr 8, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TestingLibraryElementError: Unable to find an accessible element with the role "tab" and name "Mobile Vitals New" Object.?(domainViewHeader.spec.tsx) View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants