picker icon indicating copy to clipboard operation
picker copied to clipboard

Issue with unit testing the component

Open alex-mironov opened this issue 1 year ago • 1 comments

I'm using react-native-testing library for testing the app. In scope of the test I need to fill in the form with proper value in this selector. My attempt to do it like this:

      fireEvent(await findByTestId('my-picker', 'onValueChange', 'my-value'))

has failed with error:

    TypeError: Cannot read property 'charAt' of undefined

Is there any reliable way to trigger value change inside of the picker from unit tests?

alex-mironov avatar Nov 10 '22 07:11 alex-mironov

I don't know if you still have the issue, but I was able to solve using this:

const picker = await findByTestId('picker-id');
fireEvent(picker, 'onValueChange', 'my-value');

filipebotti avatar Dec 08 '22 16:12 filipebotti