Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
TypeError: Cannot read properties of undefined (reading 'add'). Error on running jest test

I am getting the following error in a test with jest:

TypeError: Cannot read property 'add' of undefined

● Test suite failed to run

TypeError: Cannot read properties of undefined (reading 'add')

  at Object.<anonymous> (node_modules/@react-navigation/stack/lib/commonjs/utils/conditional.tsx:3:9)
  at Object.<anonymous> (node_modules/@react-navigation/stack/lib/commonjs/TransitionConfigs/CardStyleInterpolators.tsx:7:1)

I am mocking the navigator like this:

interface IProps {
    component: any,
    params?: any,
    type: 'stack' | 'tab'
}

const Stack = createStackNavigator();
const TabsNav = createBottomTabNavigator();

const MockedNavigator = ({ component, type, params = {} }: IProps) => {

  return (
    <Provider store={store}>
        <NavigationContainer>
            { type === 'stack' ? (
                <Stack.Navigator>
                    <Stack.Screen
                        name="MockedScreen"
                        component={ component }
                        initialParams={ params }
                    />
                </Stack.Navigator>
            ) : (
                <TabsNav.Navigator
                initialRouteName="HomeScreen"
            > 
                <TabsNav.Screen 
                    name="MockedScreen" 
                    component={ component } 
                    initialParams={ params }
                />
            </TabsNav.Navigator>
            )}
        
        </NavigationContainer>
        <FlashMessage position="top" testID="flash-message"/>
    </Provider>
  );
};

export default MockedNavigator;

"react-native": "0.69.1",

"@react-navigation/native": "^6.0.11",

"@react-navigation/stack": "^6.2.2",

"babel-jest": "^26.6.3",

"jest": "^26.6.3",

"react-test-renderer": "18.0.0",

"@testing-library/jest-native": "^4.0.5",

"@testing-library/react-native": "^10.1.1",

I appreciate any help with this problem.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda