react-navigation / react-navigation/react-navigation.github.io

More examples and documentation for Testing with Jest

Open
#1,152 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
324
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Couldn't find a route object. Is your component inside a screen in a navigator?

      15 |   const {
      16 |     params: {title},
    > 17 |   } = useRoute<RouteProp<RootStackParamList, typeof SMART_CONTRACT_DETAILS>>();
         |       ^
      18 |
      19 |   const {errors, handleBlur, handleChange, handleSubmit, touched, values} =
      20 |     useForm(submit);

This error doesn't help me solve anything. i have added the navigator like it has suggested.

describe('<SmartContractDetails />', () => {
  it('should render as expected', () => {
   render(
      <NavigationContainer>
        <SmartContractDetails />
      </NavigationContainer>,
    );
  });
});

Please can you add some actual examples of how to test features. like passing params and using the navigator.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing Jest/testing documentation and navigation examples in the documentation site. Add practical examples showing how to render navigated components, pass route parameters, and use a navigator, then verify that the examples address the reported missing-route error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, react-native
Domain
documentation, mobile-dev, testing
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.