Jest cannot test the component which use the RightBar
See original GitHub issueIssue

code
//devSetting component
import {NavigationContext, NavigationEvent} from 'navigation-react';
import {BarButton, NavigationBar, RightBar} from 'navigation-react-native';
import React, {useContext} from 'react';
import {ScrollView, Text} from 'react-native';
import { RootNavigationTypes } from '../../../../app.types';
export const DevSettingsScreen = () => {
const {stateNavigator} = useContext<NavigationEvent<RootNavigationTypes>>(NavigationContext);
return (
<>
<NavigationBar
title="Dev Settings"
backTitle=""
onNavigationPress={() => stateNavigator.navigateBack(1)}
navigationImage={require('../../../../../assets/arrow-left.png')}>
<RightBar>
<BarButton title="Reset" show="ifRoom" />
</RightBar>
</NavigationBar>
<ScrollView contentInsetAdjustmentBehavior="automatic">
<Text>Dev Settings Screen</Text>
</ScrollView>
</>
);
};
// test file
import 'react-native';
import React from 'react';
import {DevSettingsScreen} from './dev-settings-screen';
import {render, screen} from '@testing-library/react-native';
it('renders correctly', () => {
render(<DevSettingsScreen />)
expect(screen).toBeTruthy();
});
Issue Analytics
- State:
- Created a year ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Jest, React testing a component not exist - Stack Overflow
This is useful for asserting an element that is not present. This throws if more than one match is found (use queryAllBy instead)....
Read more >React Testing Library Tutorial - Robin Wieruch
Learn how to use React Testing Library in this tutorial. You will learn how to test your React components step by step with...
Read more >React Testing Library Tutorial – How to Write Unit Tests for ...
In this tutorial, you will learn how to confidently write unit tests using the Testing Library [https://testing-library.com/].
Read more >Testing Recipes - React
Testing Recipes. Common testing patterns for React components. Note: This page assumes you're using Jest as a test runner. If you use a...
Read more >Practically Correct, Just-in-Time Shell Script Parallelization
cant achievement even for a non-parallelizing shell—shells in widespread use differ on much larger subsets of tests. PASH-. JIT offers speedups up to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@grahammendick Sure I will. Thanks for your hard work
Hey there! I’ve finished the PR that mocks all the Navigation router components so they work with React Native Testing Library. Could you test out the mocks and let me know if you’re happy, please?