Skip to main content

All Questions

Tagged with
1 vote
2 answers
2k views

Testing lazily initialized components with Jest

I am trying to test my lazy initialized component, made with react-lazy-load-image-component using JestJS. Below are my tests: const viewModel = new VehicleViewModel(vehicleData, {}); const ...
Igor Shmukler's user avatar
1 vote
3 answers
2k views

Testing react-lazyload in React testing library

I am unit testing a component that makes use of react-lazyload to lazyload stuff. While rendering in my unit test, I noticed that the Lazyload is not rendering the content and its placeholder is being ...
Vishal's user avatar
  • 11k
3 votes
1 answer
1k views

Why doesn't the loader show on the second test when I run the same test twice in jest, using react testing library, react.lazy, and suspense?

Here is a sample of my code // App.js import React, { Suspense, lazy } from "react"; const Loader = () => <div data-testid="loader">Loading...</div> const Login = ...
George Tibetegya's user avatar
6 votes
0 answers
3k views

How can I test Lazy loaded component using jest + enzyme

In my react application I have implemented Lazy loading using React.lazy(() => import("...")). But I am not able to implement the testcase that will support Lazy load. Without React.lazy(() => ...
Bikram's user avatar
  • 343