Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
ann-marie-ward committed Jun 19, 2021
1 parent 01c92b9 commit ae72965
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/__tests__/Carousel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const slides = [
];

describe('Carousel', () => {
test('renders a carousel with class "slide"', () => {
test('renders a carousel with classes "slide , inner, item, caption"', () => {
const carousel = render(<Carousel items={slides}/>);

expect(carousel.container.querySelector('div.carousel.slide')).not.toBe(null);
Expand All @@ -19,6 +19,13 @@ describe('Carousel', () => {
expect(carousel.container.querySelector('div.carousel-caption')).not.toBe(null);
});

test('renders its content', () => {
const carousel = render(<Carousel items={slides}/>);

expect(carousel.queryByText('caption 2')).not.toBe(null);
expect(carousel.queryByText('caption INFINITY')).toBe(null);
});


test('active slide', () => {
const carousel = render(<Carousel items={slides}/>);
Expand Down Expand Up @@ -46,6 +53,4 @@ describe('Carousel', () => {
expect(mockSetProps.mock.calls).toHaveLength(1);
expect(mockSetProps.mock.calls[0][0].active_index).toBe(1);
});


});

0 comments on commit ae72965

Please sign in to comment.