-
-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathApp.test.js
More file actions
57 lines (52 loc) · 1.45 KB
/
Copy pathApp.test.js
File metadata and controls
57 lines (52 loc) · 1.45 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react';
import App from './App';
import {findByTestAttr, testStore} from "../Utils";
import {Provider} from "react-redux";
import toJson from 'enzyme-to-json';
import {shallow} from "enzyme";
const setUp = (initialState = {}) => {
const store = testStore(initialState);
const wrapper = shallow(
<Provider store={store}>
<App/>
</Provider>).childAt(0).dive();
return wrapper;
}
describe('App Component', function () {
let wrapper;
beforeEach(() => {
const initialState = {
status: {
isConnected: false,
jobs: {}
},
config: {
providers: [],
configDump: {}
},
remote: {
configs: {},
remotes: [],
files: {},
hasError: false
},
explorer: {
backStacks: {},
currentPaths: {},
visibilityFilters: {},
gridMode: {}
},
providerStatus: {
about: {}
}
};
wrapper = setUp(initialState);
});
it('should render without errors', function () {
const component = findByTestAttr(wrapper, 'appComponent');
expect(component).toHaveLength(1);
});
it('should match snapshot', function () {
expect(toJson(wrapper)).toMatchSnapshot()
});
});