mardi 30 juin 2020

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: ''
};
});

Aucun commentaire:

Enregistrer un commentaire