Stack Exchange
Not able to get react component modal in Enzyme and jest
I am getting error while running the test cases of "TypeError: Cannot read property 'find' of undefined"
it('should include modal and settings explorer', () => {
 wrapper = Enzyme.mount(<FormAccess {...wrapperProps} />);
 **expect(wrapper.find(Modal).at(0).prop('isOpen')).toBe(true);**
});

The Code looks like
let wrapper: CdsFormAccessWrapper;
let wrapperProps: CDSFormAccessProps;

 beforeEach(() => {
wrapperProps = {
  hidden: true,
  onClose: jest.fn(),
  formContext: { formId: '', formType: FormType.Main },
  entityDisplayName: '',
  entityName: ''
};
});


The component mounting should happen in the beforeEach.
beforeEach(() => {
  wrapperProps = {
    hidden: true,
    onClose: jest.fn(),
    formContext: { formId: '', formType: FormType.Main },
    entityDisplayName: '',
    entityName: ''       
 };
  wrapper = Enzyme.mount(<FormAccess {...wrapperProps} />);
});

