import { render } from '@testing-library/react-native'; import * as React from 'react'; import { Text, View } from 'react-native'; import * as UsePressable from '../hooks/usePressable'; import { TouchableWithoutFeedback, TouchableWithoutFeedbackProps, } from './TouchableWithoutFeedback'; afterEach(() => { jest.clearAllMocks(); }); describe('AMA TouchableWithoutFeedback', () => { it('uses the usePressable hook', () => { const test = { style: { backgroundColor: 'yellow' }, another: 'property', }; const spy = jest .spyOn(UsePressable, 'usePressable') .mockReturnValue(test as any); const props: Partial = { accessibilityRole: 'button', accessibilityLabel: 'hello', testID: 'test-id', style: { backgroundColor: 'red', width: 42, }, }; const renderAPI = renderTouchableWithoutFeedback(props as any); expect(spy).toHaveBeenCalledWith(props, expect.anything()); expect(renderAPI.toJSON()).toMatchInlineSnapshot(` Content `); }); }); function renderTouchableWithoutFeedback(props: TouchableWithoutFeedbackProps) { return render( Content , ); } jest.mock('../hooks/usePressable');