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"