import React from 'react'; import { fireEvent, render } from '@testing-library/react-native'; import Radio from '../Radio'; import noop from '../../helpers/noop'; describe('Radio', () => { it.each` checked ${false} ${true} `('renders correctly when checked is $checked', ({ checked }) => { const { toJSON, queryAllByText } = render(); expect(toJSON()).toMatchSnapshot(); expect(queryAllByText('Option A')).toHaveLength(1); }); it('should feedback when users press', () => { const callback = jest.fn(); const { getByText } = render(); const radio = getByText('Option A'); fireEvent.press(radio); expect(callback).toBeCalledTimes(1); }); });