summaryrefslogtreecommitdiffstats
path: root/test/app/MainScreenWrapper.test.js
blob: 51a2308855a3f74e50708446b8b8e00344540afb (plain)
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
import React from 'react';
import { mount } from 'enzyme';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'jest-fetch-mock';
import { MemoryRouter } from 'react-router';

import MainScreenWrapper from 'app/MainScreenWrapper';
import MainScreenHeader from 'app/MainScreenHeader';
import VnfSearch from 'app/vnfSearch/VnfSearch';
import TierSupport from 'app/tierSupport/TierSupport';

describe('MainScreenWrapper', () => {
  const initialState = {
    mainWrapper: {},
    globalAutoCompleteSearchBarReducer: {},
    tierSupport: {
      tierSupportReducer:{},
      globalAutoCompleteSearchBar:{},
      selectedNodeDetails:{},
      launchExternalResourceReducer:{}
    },
    inventoryReducer: {},
    vnfSearch: {},
    globalInlineMessageBar: {},
    extensibility: {},
    configurableViews: {}
  };
  const mockStore = configureStore([thunk]);
  let store;

  beforeEach(() => {
    store = mockStore(initialState);
    store.clearActions();
    fetchMock.once({});
  });

  it('renders without errors', () => {

    let wrapper = mount(
      <Provider store={store}>
        <MemoryRouter initialEntries={[ '/' ]}>
          <MainScreenWrapper/>
        </MemoryRouter>
      </Provider>
    );

    expect(wrapper.find(MainScreenHeader)).toHaveLength(1);
    expect(wrapper.find(VnfSearch)).toHaveLength(0);
    expect(wrapper.find(TierSupport)).toHaveLength(1);
  });
});