forked from greena13/react-hotkeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
38 lines (29 loc) · 1.07 KB
/
setup.js
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
/**
* Setup.js: Initializes the test environment and its dependencies
*
* This file is run once before the test suite is started.
*
* It should only include setup code that is applicable to the entire suite.
*
* For configuration options of mocha itself, see the mocha.opts file.
*/
// React testing framework for traversing React components' output
import Enzyme from 'enzyme';
import Adaptor from 'enzyme-adapter-react-16';
// Assertion library for more expressive syntax
import chai from 'chai';
// chai plugin that allows React-specific assertions for enzyme
import chaiEnzyme from 'chai-enzyme';
// chai plugin that allows assertions on function calls
import sinonChai from 'sinon-chai';
// JS implementation of DOM and HTML spec
import {JSDOM} from 'jsdom';
chai.use(chaiEnzyme());
chai.use(sinonChai);
Enzyme.configure({adapter: new Adaptor()});
const {window} = new JSDOM('<html><body></body></html>');
global.document = window.document;
global.window = window;
global.Image = window.Image;
global.navigator = window.navigator;
global.CustomEvent = window.CustomEvent;