1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import {render, screen} from 'sentry-test/reactTestingLibrary';
- import EventOrGroupTitle from 'sentry/components/eventOrGroupTitle';
- describe('EventOrGroupTitle', function () {
- const data = {
- metadata: {
- type: 'metadata type',
- directive: 'metadata directive',
- uri: 'metadata uri',
- },
- culprit: 'culprit',
- };
- it('renders with subtitle when `type = error`', function () {
- const wrapper = render(
- <EventOrGroupTitle
- data={{
- ...data,
- ...{
- type: 'error',
- },
- }}
- />
- );
- expect(wrapper.container).toSnapshot();
- });
- it('renders with subtitle when `type = csp`', function () {
- const wrapper = render(
- <EventOrGroupTitle
- data={{
- ...data,
- ...{
- type: 'csp',
- },
- }}
- />
- );
- expect(wrapper.container).toSnapshot();
- });
- it('renders with no subtitle when `type = default`', function () {
- const wrapper = render(
- <EventOrGroupTitle
- data={{
- ...data,
- type: 'default',
- metadata: {
- ...data.metadata,
- title: 'metadata title',
- },
- }}
- />
- );
- expect(wrapper.container).toSnapshot();
- });
- it('renders with title override', function () {
- const routerContext = TestStubs.routerContext([
- {organization: TestStubs.Organization({features: ['custom-event-title']})},
- ]);
- render(
- <EventOrGroupTitle
- data={{
- ...data,
- type: 'error',
- metadata: {
- ...data.metadata,
- title: 'metadata title',
- },
- }}
- />,
- {context: routerContext}
- );
- expect(screen.getByText('metadata title')).toBeInTheDocument();
- });
- });
|