MCPcopy Index your code
hub / github.com/thebuilder/react-intersection-observer / isMocking

Function isMocking

src/test-utils.ts:32–48  ·  view source on GitHub ↗

* Check if the IntersectionObserver is currently being mocked. * @return boolean

()

Source from the content-addressed store, hash-verified

30 * @return boolean
31 */
32function isMocking() {
33 const util = testLibraryUtil();
34 if (util && typeof util.isMockFunction === "function") {
35 return util.isMockFunction(window.IntersectionObserver);
36 }
37
38 // No global test utility found. Check if the IntersectionObserver was manually mocked.
39 if (
40 typeof window !== "undefined" &&
41 window.IntersectionObserver &&
42 "mockClear" in window.IntersectionObserver
43 ) {
44 return true;
45 }
46
47 return false;
48}
49
50/*
51 ** If we are running in a valid testing environment, we can automate mocking the IntersectionObserver.

Callers 1

warnOnMissingSetupFunction · 0.85

Calls 1

testLibraryUtilFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…