-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetupFiles.js
More file actions
43 lines (32 loc) · 1.08 KB
/
setupFiles.js
File metadata and controls
43 lines (32 loc) · 1.08 KB
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
39
40
41
42
43
// setup file
import _ from 'lodash';
import React from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import ReactTestRenderer from 'react-test-renderer';
import TestUtils from 'react-dom/test-utils';
import jsdom from 'jsdom';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import Enzyme, { shallow, render, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'jest-enzyme';
// React 16 Enzyme adapter
Enzyme.configure({ adapter: new Adapter() });
// Make Enzyme functions available in all test files without importing
global.shallow = shallow;
global.render = render;
global.mount = mount;
export const mockStore = configureMockStore([thunk]);
export const store = mockStore();
const localStorageMock = {
getItem: jest.fn(),
setItem: jest.fn(),
clear: jest.fn()
};
global.localStorage = localStorageMock;
// Initialize Firebase Server
let sequentialConnectionId = 0;
export function newServerUrl(port = 5000) {
return 'ws://dummy' + sequentialConnectionId++ + '.firebaseio.test:' + port;
}