From 1bd1f48fcf342e61fc3e756f180dac5fa0e543fd Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Wed, 29 May 2024 05:14:40 -0700 Subject: [PATCH] add unit test if Carousel renders children correctly --- www/__tests__/Carousel.test.tsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 www/__tests__/Carousel.test.tsx diff --git a/www/__tests__/Carousel.test.tsx b/www/__tests__/Carousel.test.tsx new file mode 100644 index 000000000..7b8601109 --- /dev/null +++ b/www/__tests__/Carousel.test.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import { render } from '@testing-library/react-native'; +import { View } from 'react-native'; +import Carousel from '../js/components/Carousel'; + +describe('Carousel component', () => { + const child1 = Child 1; + const child2 = Child 2; + const cardWidth = 100; + const cardMargin = 10; + + it('renders children correctly', () => { + const { getByTestId } = render( + + {child1} + {child2} + , + ); + + const renderedChild1 = getByTestId('child1'); + const renderedChild2 = getByTestId('child2'); + + expect(renderedChild1).toBeTruthy(); + expect(renderedChild2).toBeTruthy(); + }); +});