import {Organization} from 'fixtures/js-stubs/organization'; import {Project} from 'fixtures/js-stubs/project'; import {reactHooks, render, screen} from 'sentry-test/reactTestingLibrary'; import ProjectsStore from 'sentry/stores/projectsStore'; import {OrganizationContext} from 'sentry/views/organizationContext'; import {UserFeedbackEmpty} from 'sentry/views/userFeedback/userFeedbackEmpty'; describe('UserFeedbackEmpty', function () { const project = Project({id: '1'}); const projectWithReports = Project({id: '2', hasUserReports: true}); const projectWithoutReports = Project({id: '3'}); const organization = Organization(); it('renders empty', function () { render( ) ); }); it('renders landing for project with no user feedback', function () { reactHooks.act(() => void ProjectsStore.loadInitialData([project])); render( ) ); expect( screen.getByRole('heading', {name: 'What do users think?'}) ).toBeInTheDocument(); }); it('renders warning for project with any user feedback', function () { reactHooks.act(() => void ProjectsStore.loadInitialData([projectWithReports])); render( ) ); expect( screen.getByText('Sorry, no user reports match your filters.') ).toBeInTheDocument(); }); it('renders warning for projects with any user feedback', function () { reactHooks.act( () => void ProjectsStore.loadInitialData([project, projectWithReports]) ); render( ) ); expect( screen.getByText('Sorry, no user reports match your filters.') ).toBeInTheDocument(); }); it('renders warning for project query with user feedback', function () { reactHooks.act( () => void ProjectsStore.loadInitialData([project, projectWithReports]) ); render( ) ); expect( screen.getByText('Sorry, no user reports match your filters.') ).toBeInTheDocument(); }); it('renders landing for project query without any user feedback', function () { reactHooks.act( () => void ProjectsStore.loadInitialData([project, projectWithReports]) ); render( ) ); expect( screen.getByRole('heading', {name: 'What do users think?'}) ).toBeInTheDocument(); }); it('renders warning for multi project query with any user feedback', function () { reactHooks.act( () => void ProjectsStore.loadInitialData([project, projectWithReports]) ); render( ) ); expect( screen.getByText('Sorry, no user reports match your filters.') ).toBeInTheDocument(); }); it('renders landing for multi project query without any user feedback', function () { reactHooks.act( () => void ProjectsStore.loadInitialData([project, projectWithoutReports]) ); render( ) ); expect( screen.getByRole('heading', {name: 'What do users think?'}) ).toBeInTheDocument(); }); });