import * as React from 'react'; import { TextInput, View, Text } from 'react-native'; import { hook, TestScope, WithTestHook, Tester, useCavy } from 'cavy'; type Props = WithTestHook<{ foo: string; }>; class SampleComponent extends React.Component { textInputRef: React.ReactNode | null; constructor(props: Props) { super(props); this.textInputRef = null; } setTextInputRef = (el?: React.ReactNode) => { this.textInputRef = el; } render() { return ( {this.props.foo} ); } } const HookedSampleComponent = hook(SampleComponent); // $ExpectType ComponentClass<{ foo: string; }, any> const SampleFunctionComponent: React.FunctionComponent = () => { const generateTestHook = useCavy(); const ref = React.createRef(); return ; }; function sampleSpec(spec: TestScope) { spec.describe('it has a name and callback', () => { spec.beforeEach(() => {}); spec.it('it has a name and callback', async () => { spec.component.reRender(); // $ExpectType void spec.component.clearAsync(); // $ExpectType Promise spec.findComponent('View.Sample'); // $ExpectType Promise> spec.press('View.Sample'); // $ExpectType Promise spec.fillIn('Input.Sample', "hello world"); // $ExpectType Promise spec.pause(1000); // $ExpectType Promise spec.exists('View.Sample'); // $ExpectType Promise spec.notExists('View.MissingSample'); // $ExpectType Promise }); }); } ;