diff --git a/src/components/List/__tests__/List.test.tsx b/src/components/List/__tests__/List.test.tsx index f3bbb448a7..3eeed79cfc 100644 --- a/src/components/List/__tests__/List.test.tsx +++ b/src/components/List/__tests__/List.test.tsx @@ -2,6 +2,7 @@ import React from 'react'; import _ from 'react-virtualized-auto-sizer'; +import {setupIntersectionObserverMock} from '../../../../test-utils/setupIntersectionObserverMock'; import {cleanup, render, screen} from '../../../../test-utils/utils'; import {List} from '../List'; import type {ListProps} from '../types'; @@ -23,6 +24,10 @@ function setup(props: Partial> = {}) { const mockOnLoadMorFn = jest.fn(); +beforeAll(() => { + setupIntersectionObserverMock(); +}); + afterEach(() => { cleanup(); jest.clearAllMocks(); diff --git a/test-utils/setup-tests.ts b/test-utils/setup-tests.ts index c19bdbee6e..2d03f72af0 100644 --- a/test-utils/setup-tests.ts +++ b/test-utils/setup-tests.ts @@ -2,8 +2,6 @@ import {configure} from '@testing-library/dom'; import {Lang, configure as libConfigure} from '../src'; -import {setupIntersectionObserverMock} from './setupIntersectionObserverMock'; - libConfigure({ lang: Lang.En, }); @@ -17,8 +15,6 @@ global.ResizeObserver = class implements ResizeObserver { unobserve(_target: Element) {} }; -setupIntersectionObserverMock(); - // mock AutoSizer to properly test functionality related to virtualization // 400 x 400 is a random size and might be changed if needed jest.mock(