123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import {initializeOrg} from 'sentry-test/initializeOrg';
- import {render, screen} from 'sentry-test/reactTestingLibrary';
- import {textWithMarkupMatcher} from 'sentry-test/utils';
- import PageFiltersStore from 'sentry/stores/pageFiltersStore';
- import ProjectsStore from 'sentry/stores/projectsStore';
- import ProjectDetails from 'sentry/views/projectDetail/projectDetail';
- describe('ProjectDetail', function () {
- const {routerContext, organization, project, router} = initializeOrg();
- const params = {...router.params, projectId: project.slug} as any;
- beforeEach(() => {
- PageFiltersStore.reset();
- ProjectsStore.reset();
- // eslint-disable-next-line no-console
- jest.spyOn(console, 'error').mockImplementation(jest.fn());
- MockApiClient.addMockResponse({
- url: '/organizations/org-slug/sdk-updates/',
- body: [],
- });
- MockApiClient.addMockResponse({
- url: '/prompts-activity/',
- body: {},
- });
- });
- describe('project low priority queue alert', function () {
- it('does not render alert', function () {
- const projects = [
- {
- ...project,
- eventProcessing: {
- symbolicationDegraded: false,
- },
- },
- ];
- MockApiClient.addMockResponse({
- url: '/organizations/org-slug/projects/',
- body: projects,
- });
- MockApiClient.addMockResponse({
- url: '/projects/org-slug/project-slug/',
- body: projects[0],
- });
- ProjectsStore.loadInitialData(projects);
- render(
- <ProjectDetails
- organization={organization}
- router={router}
- location={router.location}
- params={params}
- routes={router.routes}
- routeParams={router.params}
- route={{}}
- />,
- {
- context: routerContext,
- organization,
- }
- );
- expect(
- screen.queryByText(
- 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped.',
- {exact: false}
- )
- ).not.toBeInTheDocument();
- });
- it('renders alert', async function () {
- const projects = [
- {
- ...project,
- eventProcessing: {
- symbolicationDegraded: true,
- },
- },
- ];
- ProjectsStore.loadInitialData(projects);
- MockApiClient.addMockResponse({
- url: '/organizations/org-slug/projects/',
- body: projects,
- });
- MockApiClient.addMockResponse({
- url: '/projects/org-slug/project-slug/',
- body: projects[0],
- });
- render(
- <ProjectDetails
- organization={organization}
- router={router}
- location={router.location}
- params={params}
- routes={router.routes}
- routeParams={router.params}
- route={{}}
- />,
- {
- context: routerContext,
- organization,
- }
- );
- expect(
- await screen.findByText(
- textWithMarkupMatcher(
- 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped. Please check the Status page for a potential outage.'
- )
- )
- ).toBeInTheDocument();
- });
- });
- });
|