Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

TypeError: Cannot read property 'params' of undefined Jest Testing - React Native

$
0
0

I have created a test file to test my following "BiddingScreen",

const BiddingScreen = ({ route, navigation }) => {const { currentBid } = route.params;return (<SafeAreaView style={styles.main}><Header title="BID Here" navigation={navigation} /><View style={styles.container}><Text style={styles.currentBid}>{CurrentBid}$</Text></View></SafeAreaView>)}

My test file as like follows ,

import React from 'react';import renderer from 'react-test-renderer';import BiddingScreen from "../../../src/containers/biddingScreen/BiddingScreen";jest.mock('@react-native-firebase/auth');jest.mock("react-native/Libraries/EventEmitter/NativeEventEmitter");test('renders correctly', () => {    const tree = renderer.create(< BiddingScreen />).toJSON();    expect(tree).toMatchSnapshot();});

When I'm running my test file I got this error,

TypeError: Cannot read property 'params' of undefined

So can anyone help me to solve this problem, Thank you


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>