123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- import React from 'react';
- import {shallow} from 'enzyme';
- import toJson from 'enzyme-to-json';
- import EventOrGroupHeader from 'app/components/eventOrGroupHeader';
- const data = {
- metadata: {
- title: 'metadata title',
- type: 'metadata type',
- directive: 'metadata directive',
- uri: 'metadata uri',
- value: 'metadata value',
- message: 'metadata message',
- },
- culprit: 'culprit',
- };
- describe('EventOrGroupHeader', function() {
- describe('Group', function() {
- const groupData = {
- ...data,
- level: 'error',
- id: 'id',
- };
- it('renders with `type = error`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...groupData,
- ...{
- type: 'error',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- it('renders with `type = csp`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...groupData,
- ...{
- type: 'csp',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- it('renders with `type = default`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...groupData,
- ...{
- type: 'default',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- });
- describe('Event', function() {
- const eventData = {
- ...data,
- id: 'id',
- eventID: 'eventID',
- groupID: 'groupID',
- culprit: undefined,
- };
- it('renders with `type = error`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...eventData,
- ...{
- type: 'error',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- it('renders with `type = csp`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...eventData,
- ...{
- type: 'csp',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- it('renders with `type = default`', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- data={{
- ...eventData,
- ...{
- type: 'default',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- it('hides level tag', function() {
- let component = shallow(
- <EventOrGroupHeader
- orgId="orgId"
- projectId="projectId"
- hideLevel
- data={{
- ...eventData,
- ...{
- type: 'default',
- },
- }}
- />
- );
- expect(toJson(component)).toMatchSnapshot();
- });
- });
- });
|