|
1 | 1 | import {initializeOrg} from 'sentry-test/initializeOrg'; |
2 | 2 | import {render, screen} from 'sentry-test/reactTestingLibrary'; |
3 | 3 |
|
4 | | -import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser'; |
5 | 4 | import ProjectIssueGrouping from 'sentry/views/settings/projectIssueGrouping'; |
6 | 5 |
|
7 | | -jest.mock('sentry/utils/isActiveSuperuser', () => ({ |
8 | | - isActiveSuperuser: jest.fn(), |
9 | | -})); |
10 | | - |
11 | 6 | describe('projectIssueGrouping', () => { |
12 | 7 | const {organization, projects} = initializeOrg(); |
13 | 8 | const project = projects[0]!; |
@@ -47,34 +42,21 @@ describe('projectIssueGrouping', () => { |
47 | 42 | ).toBeInTheDocument(); |
48 | 43 | }); |
49 | 44 |
|
50 | | - it('shows derived grouping enhancements only for superusers', async () => { |
51 | | - // Mock the API response |
| 45 | + it('shows derived grouping enhancements', async () => { |
52 | 46 | MockApiClient.addMockResponse({ |
53 | 47 | url: `/projects/${organization.slug}/${project.slug}/grouping-configs/`, |
54 | 48 | body: [], |
55 | 49 | }); |
56 | 50 |
|
57 | | - // First render with a non-superuser |
58 | | - const {rerender} = render(<ProjectIssueGrouping />, { |
| 51 | + render(<ProjectIssueGrouping />, { |
59 | 52 | organization, |
60 | 53 | outletContext: {project}, |
61 | 54 | }); |
62 | 55 |
|
63 | | - // Verify the section is visible for non-superuser |
64 | 56 | expect(await screen.findByText('Issue Grouping')).toBeInTheDocument(); |
65 | 57 | expect(screen.getByText(/Derived Grouping Enhancements/)).toBeInTheDocument(); |
66 | 58 | expect( |
67 | 59 | screen.getByRole('textbox', {name: /Derived Grouping Enhancements/}) |
68 | 60 | ).toBeDisabled(); |
69 | | - |
70 | | - // Re-render for superuser |
71 | | - jest.mocked(isActiveSuperuser).mockReturnValue(true); |
72 | | - rerender(<ProjectIssueGrouping />); |
73 | | - |
74 | | - // Verify the section is visible for superuser |
75 | | - expect(screen.getByText(/Derived Grouping Enhancements/)).toBeInTheDocument(); |
76 | | - expect( |
77 | | - screen.getByRole('textbox', {name: /Derived Grouping Enhancements/}) |
78 | | - ).toBeDisabled(); |
79 | 61 | }); |
80 | 62 | }); |
0 commit comments