diff options
author | Matus Szabo <matus.szabo@orange.com> | 2020-08-19 15:18:50 +0200 |
---|---|---|
committer | Matus Szabo <matus.szabo@orange.com> | 2020-08-19 15:18:50 +0200 |
commit | 371c0e2a5b8ddca26453e269a9170570832d6cc9 (patch) | |
tree | b387eb1a1cc70ac5d507059488264d5a2e7da0d0 /test/app/MainScreenWrapper.test.js | |
parent | d07851ce63f310aca9bb7b2c79943f9fe1928dcb (diff) |
Added front-end tests
Increased front-end tests coverage to 60.95%
Issue-ID: AAI-3094
Signed-off-by: Matus Szabo <matus.szabo@orange.com>
Change-Id: I3a73737175dbbbd90e21eb3030b2f4b58250ccd5
Diffstat (limited to 'test/app/MainScreenWrapper.test.js')
-rw-r--r-- | test/app/MainScreenWrapper.test.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/app/MainScreenWrapper.test.js b/test/app/MainScreenWrapper.test.js new file mode 100644 index 0000000..51a2308 --- /dev/null +++ b/test/app/MainScreenWrapper.test.js @@ -0,0 +1,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); + }); +});
\ No newline at end of file |