Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
37e8628
meta(refactor-tasks): Add no-custom-render-helper convention
ryan953 Sep 21, 2026
34cca56
test(loading): Replace renderComponent helper with ExampleLoadingCont…
ryan953 Sep 22, 2026
221fdce
test(avatar): Drop the renderComponent wrapper in avatarList specs
ryan953 Sep 22, 2026
716e568
test(modals): Drop the renderComponent wrapper in teamAccessRequestMo…
ryan953 Sep 22, 2026
96abaa1
test(seer): Replace the renderChart helper with ExampleChartEmbed
ryan953 Sep 22, 2026
46cd2fc
test(seer): Replace the renderReleaseEmbed helper with ExampleRelease…
ryan953 Sep 22, 2026
41d7637
test(seer): Replace the renderEmbed helper with ExampleLogsQueryEmbed
ryan953 Sep 22, 2026
904c40d
test(seer): Replace the renderEmbed helper with ExampleErrorsQueryEmbed
ryan953 Sep 22, 2026
1ae6666
test(seer): Replace the renderEmbed helper with ExampleMetricsQueryEmbed
ryan953 Sep 22, 2026
25bc9da
test(acl): Drop the renderComponent wrapper in featureDisabledModal s…
ryan953 Sep 22, 2026
f0bae90
test(issueDetails): Drop the renderAllEvents wrapper in eventList specs
ryan953 Sep 22, 2026
cbf8793
test(issueDetails): Replace the renderReason helper with ExampleResol…
ryan953 Sep 22, 2026
5749622
test(onboarding): Replace the renderComponent helper with ExampleCrea…
ryan953 Sep 22, 2026
5d0e790
test(replays): Replace renderWithOrganization with ExampleReplayTable…
ryan953 Sep 22, 2026
8fce52e
test(commandPalette): Replace renderFeatureFlagActions with ExampleFe…
ryan953 Sep 22, 2026
6a7fcf7
test(stackTrace): Replace the renderStackTrace helper with ExampleSta…
ryan953 Sep 22, 2026
09cda9e
test(events): Replace the renderViewer helper with ExampleLogFileViewer
ryan953 Sep 22, 2026
afb3454
test(timeRangeSelector): Replace getComponent/renderComponent with Ex…
ryan953 Sep 22, 2026
f16cc1b
test(resultGrid): Replace renderBasicGrid with ExampleBasicResultGrid
ryan953 Sep 22, 2026
c4e6ca6
test(onboarding): Replace renderCore with ExampleScmProjectDetailsCore
ryan953 Sep 22, 2026
65e5b02
test(onboarding): Replace renderActions with ExampleRowActions
ryan953 Sep 22, 2026
7433f45
test(charts): Drop the renderComponent arrow in optionSelector specs
ryan953 Sep 22, 2026
b9ab9e6
test(explore): Replace renderTooltip with ExampleDroppedDataTooltip
ryan953 Sep 22, 2026
3882ba8
test(dashboards): Drop the renderSelector wrapper in xAxisSelector specs
ryan953 Sep 22, 2026
4c9038d
test(dashboards): Drop the renderWithProvider wrapper in spansSearchB…
ryan953 Sep 22, 2026
e724013
test(preprod): Replace renderInstallPage with ExampleInstallPage
ryan953 Sep 22, 2026
81b3093
test(preprod): Replace renderSidebar with ExampleSnapshotSidebarContent
ryan953 Sep 22, 2026
12b880b
test(preprod): Replace renderImageCard with ExampleImageCard
ryan953 Sep 22, 2026
454d691
test(preprod): Replace renderListView with ExampleSnapshotListView
ryan953 Sep 22, 2026
7cf8675
test(seer): Restore the mangled comment in errorsQuery specs
ryan953 Sep 22, 2026
4218ef3
test(gsApp): Replace renderCartDiff with ExampleCartDiff
ryan953 Sep 22, 2026
2118572
test(gsApp): Replace renderCheckout with ExampleAMCheckout in billing…
ryan953 Sep 22, 2026
01eaaec
test(gsApp): Replace renderCheckout with ExampleAMCheckout in buildYo…
ryan953 Sep 22, 2026
bc711a9
test: Drop ComponentProps imports left behind by removed render helpers
ryan953 Sep 22, 2026
41225f5
test(seer): Replace renderTable with ExampleSeerProjectTable
ryan953 Sep 22, 2026
7469392
test(explore): Replace renderModal with ExampleExploreExportModal
ryan953 Sep 22, 2026
0caf7a1
test(performance): Replace renderComponent with ExampleTransactionThr…
ryan953 Sep 22, 2026
6348d8e
test(discover): Replace renderComponent with ExampleCellAction
ryan953 Sep 22, 2026
26b5820
test(discover): Replace renderComponent with ExampleTableView
ryan953 Sep 22, 2026
cb98a9b
test(navigation): Replace renderActions with ExampleTopBarActions
ryan953 Sep 22, 2026
d179b2c
test(dashboards): Replace renderPreview with ExampleWidgetPreview
ryan953 Sep 22, 2026
f614169
test(preprod): Replace renderSnapshotMainContent with ExampleSnapshot…
ryan953 Sep 22, 2026
c852a2f
test(events): Rename renderFlagDrawer to openFlagDrawer
ryan953 Sep 22, 2026
95730fb
test(events): Rename renderBreadcrumbDrawer to openBreadcrumbDrawer
ryan953 Sep 22, 2026
7dd7adf
test(explore): Replace renderButton with ExampleExploreExportModalButton
ryan953 Sep 22, 2026
1ebed80
meta(refactor-tasks): Drop the no-custom-render-helper convention fro…
ryan953 Sep 22, 2026
d64216b
test(spansSearchBar): Use regular React props instead of object spread
cursoragent Sep 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions static/app/components/acl/featureDisabledModal.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ComponentProps, PropsWithChildren} from 'react';
import type {PropsWithChildren} from 'react';
import styled from '@emotion/styled';

import {render, screen} from 'sentry-test/reactTestingLibrary';
Expand All @@ -8,35 +8,26 @@ import {FeatureDisabledModal} from 'sentry/components/acl/featureDisabledModal';
describe('FeatureTourModal', () => {
const onCloseModal = jest.fn();
const styledWrapper = styled((c: PropsWithChildren) => c.children);
const renderComponent = (
props: Partial<ComponentProps<typeof FeatureDisabledModal>> = {}
) =>
beforeEach(() => {
jest.clearAllMocks();
});

it('renders', () => {
const featureName = 'Custom Feature';
const features = ['organization:custom-feature'];

render(
<FeatureDisabledModal
Body={styledWrapper()}
Footer={styledWrapper()}
Header={() => <span>Header</span>}
closeModal={onCloseModal}
CloseButton={() => <button>Close</button>}
featureName="Default Feature"
features="organization:test-feature"
{...props}
featureName={featureName}
features={features}
/>
);

beforeEach(() => {
jest.clearAllMocks();
});

it('renders', () => {
const featureName = 'Custom Feature';
const features = ['organization:custom-feature'];

renderComponent({
featureName,
features,
});

expect(
screen.getByText('This feature is not enabled on your Sentry installation.')
).toBeInTheDocument();
Expand Down
12 changes: 4 additions & 8 deletions static/app/components/charts/optionSelector.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ describe('Charts > OptionSelector (Multiple)', () => {
);
}

const renderComponent = () => {
return render(<TestComponent />);
};

it('renders yAxisOptions with yAxisValue selected', async () => {
renderComponent();
render(<TestComponent />);
expect(await screen.findByRole('option', {name: 'count()'})).toHaveAttribute(
'aria-selected',
'true'
Expand All @@ -57,7 +53,7 @@ describe('Charts > OptionSelector (Multiple)', () => {
});

it('calls onChange prop with new checkbox option state', async () => {
renderComponent();
render(<TestComponent />);
await userEvent.click(screen.getByRole('option', {name: 'count()'}));
expect(onChangeStub).toHaveBeenCalledWith(['failure_count()']);
onChangeStub.mockClear();
Expand All @@ -79,15 +75,15 @@ describe('Charts > OptionSelector (Multiple)', () => {
});

it('does not uncheck options when clicked if only one option is currently selected', async () => {
renderComponent();
render(<TestComponent />);
await userEvent.click(screen.getByRole('option', {name: 'count()'}));
expect(onChangeStub).toHaveBeenCalledWith(['failure_count()']);
await userEvent.click(screen.getByRole('option', {name: 'failure_count()'}));
expect(onChangeStub).toHaveBeenCalledWith(['failure_count()']);
});

it('only allows up to 3 options to be checked at one time', async () => {
renderComponent();
render(<TestComponent />);
await userEvent.click(screen.getByRole('option', {name: 'count_unique(user)'}));
expect(onChangeStub).toHaveBeenCalledWith([
'count()',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ function SlotOutlets() {
);
}

function renderFeatureFlagActions(organization = OrganizationFixture()) {
render(
function ExampleFeatureFlagActions() {
return (
<Fragment>
<CommandPaletteHotkeys />
<FeatureFlagCommandPaletteActions />
<SlotOutlets />
<GlobalModal />
</Fragment>,
{organization}
</Fragment>
);
}

Expand Down Expand Up @@ -74,7 +73,7 @@ describe('FeatureFlagCommandPaletteActions', () => {

it('toggles an existing feature flag without reloading', async () => {
const organization = OrganizationFixture({features: ['enabled-feature']});
renderFeatureFlagActions(organization);
render(<ExampleFeatureFlagActions />, {organization});

await openCommandPalette();
await userEvent.type(
Expand All @@ -96,7 +95,7 @@ describe('FeatureFlagCommandPaletteActions', () => {

it('keeps a disabled feature flag in the list after returning to it', async () => {
const organization = OrganizationFixture({features: ['enabled-feature']});
renderFeatureFlagActions(organization);
render(<ExampleFeatureFlagActions />, {organization});

await openCommandPalette();
await userEvent.type(
Expand Down Expand Up @@ -131,7 +130,7 @@ describe('FeatureFlagCommandPaletteActions', () => {

it('adds a new enabled feature flag from the modal', async () => {
const organization = OrganizationFixture({features: []});
renderFeatureFlagActions(organization);
render(<ExampleFeatureFlagActions />, {organization});

await openCommandPalette();
await userEvent.type(
Expand Down
20 changes: 5 additions & 15 deletions static/app/components/core/avatar/avatarList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';

import {AvatarList} from '@sentry/scraps/avatar';

function renderComponent({
users,
teams,
}: {
users: React.ComponentProps<typeof AvatarList>['users'];
teams?: React.ComponentProps<typeof AvatarList>['teams'];
}) {
return render(<AvatarList users={users} teams={teams} />);
}

describe('AvatarList', () => {
const user = UserFixture();
const team = TeamFixture();
Expand All @@ -25,7 +15,7 @@ describe('AvatarList', () => {
{...user, id: '2', name: 'BC'},
];

renderComponent({users});
render(<AvatarList users={users} />);
expect(screen.getByText('A')).toBeInTheDocument();
expect(screen.getByText('B')).toBeInTheDocument();
expect(screen.queryByTestId('avatarList-collapsedavatars')).not.toBeInTheDocument();
Expand All @@ -41,7 +31,7 @@ describe('AvatarList', () => {
{...user, id: '6', name: 'FG'},
];

renderComponent({users});
render(<AvatarList users={users} />);
expect(screen.getByText(users[0]!.name.charAt(0))).toBeInTheDocument();
expect(screen.getByText(users[1]!.name.charAt(0))).toBeInTheDocument();
expect(screen.getByText(users[2]!.name.charAt(0))).toBeInTheDocument();
Expand All @@ -62,7 +52,7 @@ describe('AvatarList', () => {
{...user, id: '7', name: 'GH'},
];

renderComponent({users});
render(<AvatarList users={users} />);
expect(screen.getByText(users[0]!.name.charAt(0))).toBeInTheDocument();
expect(screen.getByText(users[1]!.name.charAt(0))).toBeInTheDocument();
expect(screen.getByText(users[2]!.name.charAt(0))).toBeInTheDocument();
Expand All @@ -82,7 +72,7 @@ describe('AvatarList', () => {
{...team, id: '2', name: 'B', slug: 'B', type: 'team'},
];

renderComponent({users, teams});
render(<AvatarList users={users} teams={teams} />);
expect(screen.getByText('A')).toBeInTheDocument();
expect(screen.getByText('B')).toBeInTheDocument();
expect(screen.getByText('C')).toBeInTheDocument();
Expand All @@ -96,7 +86,7 @@ describe('AvatarList', () => {
{...team, id: '2', name: 'B', slug: 'B', type: 'team'},
];

renderComponent({users: [], teams});
render(<AvatarList users={[]} teams={teams} />);
expect(screen.getByText('A')).toBeInTheDocument();
expect(screen.getByText('B')).toBeInTheDocument();
expect(screen.queryByTestId('avatarList-collapsedavatars')).not.toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('LogFileViewer', () => {
});
const attachmentUrl = `/api/0/projects/${organization.id}/${project.slug}/events/${event.id}/attachments/${attachment.id}/?download`;

function renderViewer() {
render(
function ExampleLogFileViewer() {
return (
<LogFileViewer
attachment={attachment}
eventId={event.id}
Expand All @@ -45,7 +45,7 @@ describe('LogFileViewer', () => {
]);
fetchMock.route(attachmentUrl, fetchMock.Response(bytes));

renderViewer();
render(<ExampleLogFileViewer />);

expect(await screen.findByText('A中')).toBeInTheDocument();
expect(fetchMock).toHaveBeenCalledWith(
Expand All @@ -61,7 +61,7 @@ describe('LogFileViewer', () => {
it('renders an error when the attachment cannot be downloaded', async () => {
fetchMock.route(attachmentUrl, '', {status: 404});

renderViewer();
render(<ExampleLogFileViewer />);

expect(await screen.findByText('Failed to download attachment.')).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'sentry/components/events/breadcrumbs/testUtils';
import {mockElementSize} from 'sentry/utils/fixtures/virtualization';

async function renderBreadcrumbDrawer() {
async function openBreadcrumbDrawer() {
mockElementSize({width: 0, height: 30});
render(<BreadcrumbsDataSection {...MOCK_DATA_SECTION_PROPS} />);
await userEvent.click(screen.getByRole('button', {name: 'View 2 more'}));
Expand All @@ -16,7 +16,7 @@ async function renderBreadcrumbDrawer() {

describe('BreadcrumbsDrawer', () => {
it('renders the drawer as expected', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();
expect(
within(drawerScreen).getByRole('button', {name: 'Close Drawer'})
).toBeInTheDocument();
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('BreadcrumbsDrawer', () => {
});

it('allows search to affect displayed crumbs', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();

const [warningCrumb, logCrumb] = MOCK_BREADCRUMBS;
expect(within(drawerScreen).getByText(warningCrumb.category)).toBeInTheDocument();
Expand All @@ -76,7 +76,7 @@ describe('BreadcrumbsDrawer', () => {
});

it('allows type filter to affect displayed crumbs', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();

const queryCrumb = MOCK_BREADCRUMBS[3];
const requestCrumb = MOCK_BREADCRUMBS[2];
Expand All @@ -95,7 +95,7 @@ describe('BreadcrumbsDrawer', () => {
});

it('allows level spofilter to affect displayed crumbs', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();

const [warningCrumb, logCrumb] = MOCK_BREADCRUMBS;

Expand All @@ -112,7 +112,7 @@ describe('BreadcrumbsDrawer', () => {
});

it('allows sort dropdown to affect displayed crumbs', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();

const [warningCrumb, logCrumb] = MOCK_BREADCRUMBS;

Expand Down Expand Up @@ -145,7 +145,7 @@ describe('BreadcrumbsDrawer', () => {
});

it('allows time display dropdown to change all displayed crumbs', async () => {
const drawerScreen = await renderBreadcrumbDrawer();
const drawerScreen = await openBreadcrumbDrawer();
expect(
within(drawerScreen).getAllByText('May 21, 2019 6:00:48.760 PM UTC')
).toHaveLength(MOCK_BREADCRUMBS.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import {mockElementSize} from 'sentry/utils/fixtures/virtualization';
import {GroupDataContextProvider} from 'sentry/views/issueDetails/groupDataContext';

async function renderFlagDrawer() {
async function openFlagDrawer() {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

a rename, not a refactor!

mockElementSize({width: 0, height: 30});
render(
<GroupDataContextProvider
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('FeatureFlagDrawer', () => {
});
});
it('renders the drawer as expected', async () => {
const drawerScreen = await renderFlagDrawer();
const drawerScreen = await openFlagDrawer();
expect(
within(drawerScreen).getByRole('button', {name: 'Close Drawer'})
).toBeInTheDocument();
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('FeatureFlagDrawer', () => {
});

it('allows search to affect displayed flags', async () => {
const drawerScreen = await renderFlagDrawer();
const drawerScreen = await openFlagDrawer();

const [webVitalsFlag, enableReplay] = MOCK_FLAGS.filter(f => f.result);
expect(within(drawerScreen).getByText(webVitalsFlag!.flag)).toBeInTheDocument();
Expand All @@ -89,7 +89,7 @@ describe('FeatureFlagDrawer', () => {
});

it('allows sort dropdown to affect displayed flags', async () => {
const drawerScreen = await renderFlagDrawer();
const drawerScreen = await openFlagDrawer();

const [webVitalsFlag, enableReplay] = MOCK_FLAGS.filter(f => f.result);

Expand Down
10 changes: 5 additions & 5 deletions static/app/components/loading/loadingContainer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';
import type {LoadingContainerProps} from 'sentry/components/loading/loadingContainer';
import {LoadingContainer} from 'sentry/components/loading/loadingContainer';

function renderComponent(props: LoadingContainerProps = {}) {
return render(
function ExampleLoadingContainer(props: LoadingContainerProps) {
return (
<LoadingContainer {...props}>
<div>hello!</div>
</LoadingContainer>
Expand All @@ -13,13 +13,13 @@ function renderComponent(props: LoadingContainerProps = {}) {

describe('LoadingContainer', () => {
it('handles normal state', () => {
renderComponent();
render(<ExampleLoadingContainer />);
expect(screen.getByText('hello!')).toBeInTheDocument();
expect(() => screen.getByTestId('loading-indicator')).toThrow();
});

it('handles loading state', () => {
const {rerender} = renderComponent({isLoading: true});
const {rerender} = render(<ExampleLoadingContainer isLoading />);
expect(screen.getByText('hello!')).toBeInTheDocument();
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
rerender(<LoadingContainer isLoading />);
Expand All @@ -28,7 +28,7 @@ describe('LoadingContainer', () => {
});

it('handles reloading state', () => {
const {rerender} = renderComponent({isReloading: true});
const {rerender} = render(<ExampleLoadingContainer isReloading />);
expect(screen.getByText('hello!')).toBeInTheDocument();
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
rerender(<LoadingContainer isReloading />);
Expand Down
Loading
Loading