import { fireEvent, render } from '@testing-library/react-native' import * as React from 'react' import { Text } from 'react-native' import { TopBarIconButton, TopBarTextButton } from 'src/navigator/TopBarButton' const testID = 'button' describe('TopBarTextButton', () => { it('renders with minimum props', () => { const onPress = jest.fn() const { queryByText } = render( ) expect(queryByText('label')?.props.children).toEqual('label') }) it('fires an event when pressed', () => { const onPress = jest.fn() const { queryByTestId } = render( ) fireEvent.press(queryByTestId(testID)!) expect(onPress).toBeCalled() }) }) describe('TopBarIconButton', () => { it('renders with minimum props', () => { const onPress = jest.fn() const { queryByText } = render( icon} onPress={onPress} /> ) expect(queryByText('icon')?.props.children).toEqual('icon') }) it('fires an event when pressed', () => { const onPress = jest.fn() const { queryByTestId } = render( icon} onPress={onPress} /> ) fireEvent.press(queryByTestId(testID)!) expect(onPress).toBeCalled() }) })