forked from Azure/azure-iot-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjestSetup.ts
28 lines (23 loc) · 862 Bytes
/
jestSetup.ts
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
/***********************************************************
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License
**********************************************************/
import { setIconOptions } from '@fluentui/react';
import * as Enzyme from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';
// tslint:disable-next-line: no-string-literal
global['Headers'] = () => {};
window.parent.fetch = jest.fn();
// suppress icon warnings.
setIconOptions({
disableWarnings: true,
});
Enzyme.configure({ adapter: new Adapter() });
document.execCommand = jest.fn(); // maskedCopyableTextField
// fix for smooth-dnd invocation error in test
Object.defineProperty(global, 'Node', {
value: {firstElementChild: jest.fn()}
});
jest.mock('react-i18next', () => ({
useTranslation: () => ({t: key => key})
}));