-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathsetup.ts
More file actions
40 lines (35 loc) · 1.08 KB
/
setup.ts
File metadata and controls
40 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { TextDecoder, TextEncoder } from 'util';
import '@testing-library/jest-dom';
// Polyfill for jsdom (react-router etc. may use these)
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder as typeof global.TextDecoder;
// Mock PatternFly Chatbot MessageBar to avoid monaco-editor dependency
jest.mock('@patternfly/chatbot/dist/dynamic/MessageBar', () => ({
MessageBar: jest.fn(() => null),
}));
// Mock CSS imports
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
// Mock ResizeObserver
global.ResizeObserver = class ResizeObserver {
observe = jest.fn();
unobserve = jest.fn();
disconnect = jest.fn();
};
// Mock IntersectionObserver
global.IntersectionObserver = class IntersectionObserver {
observe = jest.fn();
unobserve = jest.fn();
disconnect = jest.fn();
} as any;