-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
29 lines (25 loc) · 789 Bytes
/
jest.setup.js
File metadata and controls
29 lines (25 loc) · 789 Bytes
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
import { TextEncoder, TextDecoder } from'util';
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
// Mock básico para Web Components (sin jest.fn())
global.customElements = global.customElements || {
define: () => {},
get: () => undefined,
upgrade: () => {},
whenDefined: () => Promise.resolve(),
};
// Mock básico para Shadow DOM
if (!global.HTMLElement.prototype.attachShadow) {
global.HTMLElement.prototype.attachShadow = function() {
return {
innerHTML: '',
appendChild: () => {},
insertBefore: () => {},
removeChild: () => {},
};
};
}
// Mock para document.body si no existe
if (!global.document.body) {
global.document.body = global.document.createElement('body');
}