12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import {reactHooks, render, screen} from 'sentry-test/reactTestingLibrary';
- import ProjectsStore from 'sentry/stores/projectsStore';
- import {UserFeedbackEmpty} from 'sentry/views/userFeedback/userFeedbackEmpty';
- describe('UserFeedbackEmpty', function () {
- const project = TestStubs.Project({id: '1'});
- const projectWithReports = TestStubs.Project({id: '2', hasUserReports: true});
- const projectWithoutReports = TestStubs.Project({id: '3'});
- it('renders empty', function () {
- render(<UserFeedbackEmpty />);
- });
- it('renders landing for project with no user feedback', function () {
- reactHooks.act(() => void ProjectsStore.loadInitialData([project]));
- render(<UserFeedbackEmpty />);
- 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(<UserFeedbackEmpty />);
- 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(<UserFeedbackEmpty />);
- 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(<UserFeedbackEmpty projectIds={[projectWithReports.id]} />);
- 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(<UserFeedbackEmpty projectIds={[project.id]} />);
- 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(<UserFeedbackEmpty projectIds={[project.id, projectWithReports.id]} />);
- 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(<UserFeedbackEmpty projectIds={[project.id, projectWithoutReports.id]} />);
- expect(
- screen.getByRole('heading', {name: 'What do users think?'})
- ).toBeInTheDocument();
- });
- });
|