summaryrefslogtreecommitdiffstats
path: root/test/app
diff options
context:
space:
mode:
authorMatus Szabo <matus.szabo@orange.com>2020-08-19 15:18:50 +0200
committerMatus Szabo <matus.szabo@orange.com>2020-08-19 15:18:50 +0200
commit371c0e2a5b8ddca26453e269a9170570832d6cc9 (patch)
treeb387eb1a1cc70ac5d507059488264d5a2e7da0d0 /test/app
parentd07851ce63f310aca9bb7b2c79943f9fe1928dcb (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')
-rw-r--r--test/app/Application.test.js14
-rw-r--r--test/app/MainScreenWrapper.test.js53
2 files changed, 67 insertions, 0 deletions
diff --git a/test/app/Application.test.js b/test/app/Application.test.js
new file mode 100644
index 0000000..87d6c4c
--- /dev/null
+++ b/test/app/Application.test.js
@@ -0,0 +1,14 @@
+import React from 'react';
+import {shallow} from 'enzyme';
+import Application from 'app/Application';
+
+describe('Application', () => {
+ it('renders children when passed in', () => {
+ const wrapper = shallow((
+ <Application>
+ <div className="unique"/>
+ </Application>
+ ));
+ expect(wrapper.contains(<div className="unique" />)).toEqual(true);
+ });
+}); \ No newline at end of file
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