Skip to content

Commit

Permalink
#237 - Creating carousel cards tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlfaa committed Dec 16, 2021
1 parent c6afa11 commit b161edb
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Render Carousel Item 1`] = `ReactWrapper {}`;

exports[`Render Carousel With Data 1`] = `ReactWrapper {}`;

exports[`snapshot should not have changes 1`] = `ShallowWrapper {}`;
61 changes: 61 additions & 0 deletions src/components/CarouselCards/__test__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import CaroulselCards from '../index';
import TotalFrame from '../../Frames/TotalFrame';
import MockTheme from '../../../mocks/theme/mockTheme';
import * as TEXTCONSTANTS from '../../../settings/texts/AudienciasPage';

const carouselItens = [
{
isLoaded: true,
info: 10,
title: TEXTCONSTANTS.audiencesTotalsTexts.subSectionParticipantsTotals.title,
toolTipText: TEXTCONSTANTS.audiencesTotalsTexts.subSectionParticipantsTotals.toolTip,
toolTipAriaLabel: TEXTCONSTANTS.audiencesTotalsTexts.subSectionParticipantsTotals
.toolTipAriaLabel,
toolTipColor: '#FFFF',
},
{
isLoaded: true,
info: 10,
title: TEXTCONSTANTS.audiencesTotalsTexts.subSectionAudiencesTotals.title,
toolTipText: TEXTCONSTANTS.audiencesTotalsTexts.subSectionAudiencesTotals.toolTip,
toolTipAriaLabel: TEXTCONSTANTS.audiencesTotalsTexts.subSectionAudiencesTotals.toolTipAriaLabel,
oolTipColor: '#FFFF',
subInformation: '2 realizadas',
},
{
isLoaded: true,
info: 10,
title: TEXTCONSTANTS.audiencesTotalsTexts.subSectionMessagesTotals.title,
toolTipText: TEXTCONSTANTS.audiencesTotalsTexts.subSectionMessagesTotals.toolTip,
toolTipAriaLabel: TEXTCONSTANTS.audiencesTotalsTexts.subSectionMessagesTotals.toolTipAriaLabel,
toolTipColor: '#FFFF',
},
{
isLoaded: true,
info: 10,
title: TEXTCONSTANTS.audiencesTotalsTexts.subSectionQuestionsTotals.title,
toolTipText: TEXTCONSTANTS.audiencesTotalsTexts.subSectionQuestionsTotals.toolTip,
toolTipAriaLabel: TEXTCONSTANTS.audiencesTotalsTexts.subSectionQuestionsTotals.toolTipAriaLabel,
},
];

it('snapshot should not have changes', () => {
const component = shallow(<MockTheme><CaroulselCards carouselItens={[]} /></MockTheme>);
expect(component.exists()).toEqual(true);
expect(component).toMatchSnapshot();
});

it('Render Carousel With Data', () => {
const component = mount(<MockTheme><CaroulselCards carouselItens={carouselItens} /></MockTheme>);
expect(component.exists()).toEqual(true);
expect(component).toMatchSnapshot();
});

// Test Caroulsel Item
it('Render Carousel Item', () => {
const component = mount(<MockTheme><TotalFrame item={carouselItens[0]} /></MockTheme>);
expect(component.exists()).toEqual(true);
expect(component).toMatchSnapshot();
});

0 comments on commit b161edb

Please sign in to comment.