Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions static/app/views/issueList/groupListBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {LoadingStreamGroup, StreamGroup} from 'sentry/components/stream/group';
import {SupergroupRow} from 'sentry/components/stream/supergroups/supergroupRow';
import {GroupStore} from 'sentry/stores/groupStore';
import type {Group} from 'sentry/types/group';
import {useApi} from 'sentry/utils/useApi';
import {useMedia} from 'sentry/utils/useMedia';
import {useOrganization} from 'sentry/utils/useOrganization';
import {useSyncedLocalStorageState} from 'sentry/utils/useSyncedLocalStorageState';
Expand Down Expand Up @@ -95,7 +94,6 @@ export function GroupListBody({
onActionTaken,
supergroupLookup,
}: GroupListBodyProps) {
const api = useApi();
const organization = useOrganization();

if (loading) {
Expand All @@ -114,7 +112,6 @@ export function GroupListBody({
if (!groupIds.length) {
return (
<NoGroupsHandler
api={api}
organization={organization}
query={query}
selectedProjectIds={selectedProjectIds}
Expand Down
25 changes: 23 additions & 2 deletions static/app/views/issueList/noGroupsHandler/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';

import {render, screen} from 'sentry-test/reactTestingLibrary';

import {NoGroupsHandler} from 'sentry/views/issueList/noGroupsHandler';

describe('NoGroupsHandler', () => {
const defaultProps = {
api: new MockApiClient(),
query: '',
organization: OrganizationFixture(),
groupIds: [],
selectedProjectIds: [],
};

it('displays default empty state when first event has been sent', async () => {
MockApiClient.addMockResponse({
const projectsMock = MockApiClient.addMockResponse({
url: '/organizations/org-slug/projects/',
body: [],
});
Expand All @@ -25,6 +26,7 @@ describe('NoGroupsHandler', () => {
render(<NoGroupsHandler {...defaultProps} />);

expect(await screen.findByText('No issues match your search')).toBeInTheDocument();
expect(projectsMock).not.toHaveBeenCalled();
});

it('displays default empty state when an error occurs', async () => {
Expand All @@ -43,6 +45,25 @@ describe('NoGroupsHandler', () => {
});

it('displays waiting for events state when first event has not been sent', async () => {
MockApiClient.addMockResponse({
url: '/organizations/org-slug/projects/',
body: [ProjectFixture()],
});
MockApiClient.addMockResponse({
url: '/projects/org-slug/project-slug/issues/',
body: [],
});
MockApiClient.addMockResponse({
url: '/organizations/org-slug/sent-first-event/',
body: {sentFirstEvent: false},
});

render(<NoGroupsHandler {...defaultProps} />);

expect(await screen.findByText(/Waiting for events/i)).toBeInTheDocument();
});

it('displays waiting for events state when no projects exist yet', async () => {
MockApiClient.addMockResponse({
url: '/organizations/org-slug/projects/',
body: [],
Expand Down
Loading
Loading