From 4780ef2c54c2b03897caa8ff0c2908e94d3a30a8 Mon Sep 17 00:00:00 2001 From: Alexis DRAI Date: Wed, 7 Jun 2023 14:27:46 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20a=20test=20to=20appease=20the?= =?UTF-8?q?=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit More tests will follow at the end if there is time --- components/TypeTacticsInfoList.test.tsx | 25 +++++++++++++++++++++++++ yarn.lock | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 components/TypeTacticsInfoList.test.tsx diff --git a/components/TypeTacticsInfoList.test.tsx b/components/TypeTacticsInfoList.test.tsx new file mode 100644 index 0000000..4a8bee7 --- /dev/null +++ b/components/TypeTacticsInfoList.test.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import {render} from '@testing-library/react-native'; +import TypeTacticsInfoList from './TypeTacticsInfoList'; + +describe('TypeTacticsInfoList component', () => { + it('renders types correctly', () => { + const types = ['FIRE', 'WATER', 'GRASS']; + const {getByText} = render(); + + types.forEach(type => { + expect(getByText(type)).toBeTruthy(); + }); + }); + + it('renders "Nothing" when types array is empty', () => { + const {getByText} = render(); + expect(getByText('Nothing')).toBeTruthy(); + }); + + it('renders "Nothing" when types is undefined', () => { + // @ts-ignore + const {getByText} = render(); + expect(getByText('Nothing')).toBeTruthy(); + }); +}); diff --git a/yarn.lock b/yarn.lock index daf9baf..563e42a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2187,7 +2187,7 @@ "@testing-library/react-native@^12.1.2": version "12.1.2" - resolved "https://registry.npmjs.org/@testing-library/react-native/-/react-native-12.1.2.tgz" + resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-12.1.2.tgz#1935affe1106aeddf0087dff31a6d7414917c098" integrity sha512-5rQMQpbSQAuJc4TxjTt1IoeT1a5eVXaa61hf/YcjV2QtGqCoyhuW8DvhTowrL7y2Ds4NzuYBmbVxjNPR6GIblw== dependencies: pretty-format "^29.0.0"