enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

Getting issue with mounting the component #2474

Open msreddy09 opened 3 years ago

msreddy09 commented 3 years ago

My component is having ref, so I have tried to render the component by mount

But I am getting the following errors

Const wrapper = mount (<MyGraph {...componentProps} />); ^ Element type is invalid : expected a string (for built-in components ) or a class / function (for composite components) but got: undefined . you likely forgot to export your component from the file it’s defined in or you might have mixed up default and named imports

The minimal component structure is

leftClick(){
  this.ref.scrollview.scrollTo()
}
reder() {
  return (
  <View>
     ----
     <ScrollView refs="scrollview" ---- ><View></View><ScrollView>
 </View>)
}

Note: I am sure that no issues with imports and code. The same component is working with shallow rendering except for refs, so I have moved to 'mount'

ljharb commented 3 years ago

I'd hope it's render and not reder, but either way i'd need the entirety of the component and test code. Additionally, please fill out the entire issue template; that's why it's there.