forked from SwiftChainn/SwiftChain_Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
26 lines (22 loc) · 720 Bytes
/
Copy pathjest.setup.ts
File metadata and controls
26 lines (22 loc) · 720 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
import '@testing-library/jest-dom';
// ResizeObserver is not available in jsdom
global.ResizeObserver = class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
};
// scrollIntoView is not available in jsdom — required by cmdk
Element.prototype.scrollIntoView = jest.fn();
// jsdom doesn't implement URL.createObjectURL / revokeObjectURL
if (typeof URL.createObjectURL === 'undefined') {
// @ts-ignore - augment global URL in tests
URL.createObjectURL = function (blob: any) {
return 'blob://mock-' + Math.random().toString(36).slice(2);
};
}
if (typeof URL.revokeObjectURL === 'undefined') {
// @ts-ignore
URL.revokeObjectURL = function (_url: string) {
return undefined;
};
}