From 7c7f37c39d8834c3a0ce51cd80c378f8b93ef18f Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Fri, 23 Jun 2023 19:15:02 +0200 Subject: [PATCH] add basic styling test for addressbook & coin selection modal usage --- src/components/modal/index.tsx | 1 + test/components/AddressBook.test.tsx | 13 +++++++++++++ test/components/CoinSelectionModal.test.tsx | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 test/components/CoinSelectionModal.test.tsx diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index 9012a8f2..f49c071b 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -58,6 +58,7 @@ export default function MyModal({ transparent animationType={animation} onRequestClose={close} + testID='testCoinSelectionModal' > { fireEvent.press(screen.getByTestId('addPersonal')) expect(screen.queryByPlaceholderText('Name')).toBeNull() }) + it('Addressbook modal has a specific style applied', () => { + render( + l('test')} + setInput={() => l('test')} + /> + ) + const modal = screen.getByTestId('testCoinSelectionModal') + expect(modal.props.children.props.children.props.style[0].paddingHorizontal).toBe(0) + }) // TODO test the functionality of adding a new contact and rendering it // eslint-disable-next-line jest/no-commented-out-tests // it('Render the new contact', async () => { diff --git a/test/components/CoinSelectionModal.test.tsx b/test/components/CoinSelectionModal.test.tsx new file mode 100644 index 00000000..e8830cb6 --- /dev/null +++ b/test/components/CoinSelectionModal.test.tsx @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +import { CoinSelectionModal } from '@screens/Lightning/modal' +import { l } from '@src/logger' +import { render, screen } from '@testing-library/react-native' + +describe('Basic styling test of the CoinSelectionModal component', () => { + it('has a specific style applied', () => { + render( + l('test coin selection modal')} + proofs={[]} + setProof={() => l('proofs')} + /> + ) + const modal = screen.getByTestId('testCoinSelectionModal') + expect(modal.props.children.props.children.props.style[0].paddingHorizontal).toBe(0) + }) +})