react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

test: change queryByText to getByText in useUnhandledLinking.test.tsx #11913

Closed tboba closed 1 month ago

tboba commented 1 month ago

Motivation

In useUnhandledLinking.test.tsx file, we're trying to query the element with given label and press it with fireEvent.press. Unfortunately, in my case Typescript prints several warnings about the wrong return type of passed argument. In fact, Typescript is correct there - we're trying to pass the argument of type ReactTestInstance | null to the function that accepts arguments of type ReactTestInstance. Because of that, I'm willing to change queryByText to getByText in places where the tests are trying to press the element with queried label.

I'm also leaving remains of the queryByText in the expect functions intentionally, since we're still expecting that some elements will be null there.

Test plan

Passing CI should be enough to check if that works! ✅

github-actions[bot] commented 1 month ago

The Expo app for the example from this branch is ready!

https://expo.dev/@react-navigation/react-navigation-example?serviceType=eas&distribution=expo-go&scheme=exp+react-navigation-example&channel=pr-11913&sdkVersion=50.0.0

netlify[bot] commented 1 month ago

Deploy Preview for react-navigation-example ready!

Name Link
Latest commit 00136e4d9b247f355fab0f8f3c9f227b37f040f0
Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/6604358d1133800008084c47
Deploy Preview https://deploy-preview-11913--react-navigation-example.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.