Testing Styled Components
Let’s check how our tests are doing, starting with Carousel:
| $ npx jest src/tests/Carousel.test.js |
| FAIL src/tests/Carousel.test.js |
| Carousel |
| ✓ renders a <div> (5ms) |
| ✓ has an initial `slideIndex` of 0 (1ms) |
| ✓ renders a CarouselButton labeled "Prev" (1ms) |
| ✓ renders a CarouselButton labeled "Next" |
| ✕ renders the current slide as a CarouselSlide (12ms) |
| with a middle slide selected |
| ✓ decrements `slideIndex` when Prev is clicked (4ms) |
| ✓ increments `slideIndex` when Next is clicked (1ms) |
| with the first slide selected |
| ✓ wraps `slideIndex` to the max value when Prev is clicked |
| with the last slide selected |
| ✓ wraps `slideIndex` to the min value when Next is clicked (1ms) |
| |
| ● Carousel › ... |
Get Test-Driven React now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.