@@ -2,10 +2,12 @@ import { render } from '@testing-library/react-native';
22import * as React from 'react' ;
33import { Text , View } from 'react-native' ;
44
5- import { NavigationContainer } from '../src/js/NavigationContainer' ;
5+ import { NAVIGATION_CONTAINER_INTEGRATION_NAME , NavigationContainer } from '../src/js/NavigationContainer' ;
66
77const mockRegisterNavigationContainer = jest . fn ( ) ;
88const mockGetClient = jest . fn ( ) ;
9+ const mockAddIntegration = jest . fn ( ) ;
10+ const mockGetIntegrationByName = jest . fn ( ) ;
911const mockDebugLog = jest . fn ( ) ;
1012const mockDebugWarn = jest . fn ( ) ;
1113
@@ -47,12 +49,25 @@ jest.mock('../src/js/reactNavigationImport', () => ({
4749describe ( 'NavigationContainer' , ( ) => {
4850 beforeEach ( ( ) => {
4951 jest . clearAllMocks ( ) ;
50- mockGetClient . mockReturnValue ( { getIntegrationByName : jest . fn ( ) } ) ;
52+ mockGetIntegrationByName . mockReturnValue ( undefined ) ;
53+ mockGetClient . mockReturnValue ( {
54+ getIntegrationByName : mockGetIntegrationByName ,
55+ addIntegration : mockAddIntegration ,
56+ } ) ;
5157 mockGetReactNavigationIntegration . mockReturnValue ( {
5258 registerNavigationContainer : mockRegisterNavigationContainer ,
5359 } ) ;
5460 } ) ;
5561
62+ it ( 'registers the NavigationContainer feature marker on mount' , ( ) => {
63+ render (
64+ < NavigationContainer >
65+ < Text > App</ Text >
66+ </ NavigationContainer > ,
67+ ) ;
68+ expect ( mockAddIntegration ) . toHaveBeenCalledWith ( { name : NAVIGATION_CONTAINER_INTEGRATION_NAME } ) ;
69+ } ) ;
70+
5671 it ( 'renders children through to the underlying NavigationContainer' , ( ) => {
5772 const { getByText } = render (
5873 < NavigationContainer >
0 commit comments