StackOverflow - StackOverflow

Why does shallow Rendering not work as expected?

Use ().toEqual() instead of .to.have.length() as .to.have is not any function in jest expect library Visit here for more info

import React from "react";
import TestUser from "./testuser";
import { shallow } from "enzyme";

it("should render right", () => {
const component = shallow(<TestUser />);

expect(component.find('Card').length).toEqual(3);
});

Was this helpful?

Have a different question?

Can't find the answer you're looking for? Submit your own question to our community.

🛎️ Get Weekly OTA Fixes

New answers, vendor issues, and updates — straight to your inbox.