|
@@ -1,41 +1,14 @@
|
|
|
-import {InjectedRouter} from 'react-router';
|
|
|
+import {Fragment} from 'react';
|
|
|
|
|
|
import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
|
import {render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import EventTagsAndScreenshot from 'sentry/components/events/eventTagsAndScreenshot';
|
|
|
import GlobalModal from 'sentry/components/globalModal';
|
|
|
-import {EventAttachment, Organization} from 'sentry/types';
|
|
|
-import {OrganizationContext} from 'sentry/views/organizationContext';
|
|
|
-import {RouteContext} from 'sentry/views/routeContext';
|
|
|
+import {EventAttachment} from 'sentry/types';
|
|
|
|
|
|
import {deviceNameMapper} from '../../../../../static/app/components/deviceName';
|
|
|
|
|
|
-function TestComponent({
|
|
|
- organization,
|
|
|
- router,
|
|
|
- children,
|
|
|
-}: {
|
|
|
- children: React.ReactNode;
|
|
|
- organization: Organization;
|
|
|
- router: InjectedRouter;
|
|
|
-}) {
|
|
|
- return (
|
|
|
- <OrganizationContext.Provider value={organization}>
|
|
|
- <RouteContext.Provider
|
|
|
- value={{
|
|
|
- router,
|
|
|
- location: router.location,
|
|
|
- params: {},
|
|
|
- routes: [],
|
|
|
- }}
|
|
|
- >
|
|
|
- {children}
|
|
|
- </RouteContext.Provider>
|
|
|
- </OrganizationContext.Provider>
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
describe('EventTagsAndScreenshot', function () {
|
|
|
const contexts = {
|
|
|
app: {
|
|
@@ -181,17 +154,15 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
describe('renders tags only', function () {
|
|
|
it('not shared event - without attachments', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, tags, contexts}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={[]}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, tags, contexts}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={[]}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|
|
@@ -234,18 +205,16 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
|
|
|
it('shared event - without attachments', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, tags, contexts}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={[]}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext
|
|
|
- isShare
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, tags, contexts}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={[]}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext
|
|
|
+ isShare
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|
|
@@ -259,18 +228,16 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
|
|
|
it('shared event - with attachments', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, tags, contexts}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={attachments}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext
|
|
|
- isShare
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, tags, contexts}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={attachments}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext
|
|
|
+ isShare
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|
|
@@ -301,7 +268,7 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
|
|
|
it('no context and no tags', async function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
+ <Fragment>
|
|
|
<GlobalModal />
|
|
|
<EventTagsAndScreenshot
|
|
|
event={event}
|
|
@@ -312,7 +279,7 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
onDeleteScreenshot={() => jest.fn()}
|
|
|
hasContext={false}
|
|
|
/>
|
|
|
- </TestComponent>
|
|
|
+ </Fragment>
|
|
|
);
|
|
|
|
|
|
// Tags Container
|
|
@@ -353,17 +320,15 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
describe('renders screenshot and tags', function () {
|
|
|
it('has context, tags and attachments', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, tags, contexts}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={attachments}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, tags, contexts}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={attachments}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|
|
@@ -388,17 +353,15 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
|
|
|
it('has context and attachments only', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, contexts}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={attachments}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, contexts}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={attachments}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|
|
@@ -423,17 +386,15 @@ describe('EventTagsAndScreenshot', function () {
|
|
|
|
|
|
it('has tags and attachments only', function () {
|
|
|
const {container} = render(
|
|
|
- <TestComponent organization={organization} router={router}>
|
|
|
- <EventTagsAndScreenshot
|
|
|
- event={{...event, tags}}
|
|
|
- organization={organization}
|
|
|
- projectId={project.slug}
|
|
|
- location={router.location}
|
|
|
- attachments={attachments}
|
|
|
- onDeleteScreenshot={() => jest.fn()}
|
|
|
- hasContext={false}
|
|
|
- />
|
|
|
- </TestComponent>
|
|
|
+ <EventTagsAndScreenshot
|
|
|
+ event={{...event, tags}}
|
|
|
+ organization={organization}
|
|
|
+ projectId={project.slug}
|
|
|
+ location={router.location}
|
|
|
+ attachments={attachments}
|
|
|
+ onDeleteScreenshot={() => jest.fn()}
|
|
|
+ hasContext={false}
|
|
|
+ />
|
|
|
);
|
|
|
|
|
|
// Screenshot Container
|