alexa

React testing with Jest and Enzyme: How to write test for connected components with API call and props in react.js ?

React testing with Jest and Enzyme: How to write test for connected components with API call and props in react.js ?
 test("renders singleitem with data", async () => {
    const mockupData = {
      name: "Homer Simpson",
      job: "Nuclear Safety Inspector",
      id: "14",
    };

    render(
          <SingleItem data={mockupData} />
    );
    
    const element = await screen.findByText(/Homer Simpson/i);
    expect(element).toBeInTheDocument();
    
  });

179 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry