I am writing test cases for one of my component which is having router.and i am getting error wrapper.find is not a function. Basic requirement is need to check the existence of tag in my render,also check the aria-label attribute of tag
const Component = () => const WrappedComponent = withRouter(Component)
describe('Error Boundary...', () => {
it('should render children when no error is encountered', () => {
const wrapper = ReactTestRenderer.create(
<Router><WrappedComponent /></Router>
);
expect(wrapper.toJSON().type).toEqual('div');
expect(wrapper.toJSON()find('a').attr('aria-label')).toEqual('Hello World');
});
});
Aucun commentaire:
Enregistrer un commentaire