-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitClientTests.js
35 lines (29 loc) · 924 Bytes
/
initClientTests.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
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import { JSDOM } from 'jsdom';
import auth0 from 'auth0-js';
const jsdom = new JSDOM('<!doctype html><html><body></body></html>');
const { window } = jsdom;
function copyProps(src, target) {
const props = Object.getOwnPropertyNames(src)
.filter(prop => typeof target[prop] === 'undefined')
.reduce((result, prop) => ({
...result,
[prop]: Object.getOwnPropertyDescriptor(src, prop),
}), {});
Object.defineProperties(target, props);
}
/* Initialize configuration */
window.config = {
AUTH0_DOMAIN: 'unitTesting.fakeAuth0.com',
AUTH0_CLIENT_ID: 'fake-client-id'
};
global.auth0 = auth0;
global.window = window;
global.document = window.document;
global.navigator = {
userAgent: 'node.js',
};
global.self = {navigator: global.navigator };
copyProps(window, global);
configure({ adapter: new Adapter() });