# sliderberg/1.2.3/src/__tests__/setup.ts

Slider Block by Sliderberg – WordPress Slider &amp; Carousel Plugin for Gutenberg, version 1.2.3. 62 lines.

- Page: https://pluginprobe.com/plugins/sliderberg/1.2.3/code/src/__tests__/setup.ts
- Raw: https://pluginprobe.com/plugins/sliderberg/1.2.3/raw/src/__tests__/setup.ts
- Modified: 2026-09-15T03:04:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sliderberg/1.2.3/code/src/__tests__/setup.ts#L10-L20`.

```typescript
/**
 * Jest setup file for Sliderberg tests
 *
 * This file runs after Jest is initialized but before tests execute.
 * Use it to set up global test utilities and mocks.
 */

import '@testing-library/jest-dom';

// Mock ResizeObserver which is not available in JSDOM
class ResizeObserverMock {
	observe = jest.fn();
	unobserve = jest.fn();
	disconnect = jest.fn();
}

global.ResizeObserver = ResizeObserverMock as unknown as typeof ResizeObserver;

// Mock IntersectionObserver which is not available in JSDOM
class IntersectionObserverMock {
	readonly root: Element | null = null;
	readonly rootMargin: string = '';
	readonly thresholds: ReadonlyArray< number > = [];

	observe = jest.fn();
	unobserve = jest.fn();
	disconnect = jest.fn();
	takeRecords = jest.fn( () => [] );
}

global.IntersectionObserver =
	IntersectionObserverMock as unknown as typeof IntersectionObserver;

// Mock matchMedia for responsive tests
Object.defineProperty( window, 'matchMedia', {
	writable: true,
	value: jest.fn().mockImplementation( ( query: string ) => ( {
		matches: false,
		media: query,
		onchange: null,
		addListener: jest.fn(), // Deprecated
		removeListener: jest.fn(), // Deprecated
		addEventListener: jest.fn(),
		removeEventListener: jest.fn(),
		dispatchEvent: jest.fn(),
	} ) ),
} );

// Suppress console errors during tests (optional, comment out for debugging)
// const originalError = console.error;
// beforeAll(() => {
//   console.error = (...args: unknown[]) => {
//     if (typeof args[0] === 'string' && args[0].includes('Warning:')) {
//       return;
//     }
//     originalError.call(console, ...args);
//   };
// });
// afterAll(() => {
//   console.error = originalError;
// });

```
