Skip to content

Commit

Permalink
feat: remove global IntersectionObserverMock set up
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisVershkov committed Apr 15, 2024
1 parent da98514 commit e36ec12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/components/List/__tests__/List.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -23,6 +24,10 @@ function setup(props: Partial<ListProps<string>> = {}) {

const mockOnLoadMorFn = jest.fn();

beforeAll(() => {
setupIntersectionObserverMock();
});

afterEach(() => {
cleanup();
jest.clearAllMocks();
Expand Down
4 changes: 0 additions & 4 deletions test-utils/setup-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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(
Expand Down

0 comments on commit e36ec12

Please sign in to comment.