summaryrefslogtreecommitdiffstats
path: root/test/tierSupport/autoCompleteSearchBar
diff options
context:
space:
mode:
Diffstat (limited to 'test/tierSupport/autoCompleteSearchBar')
-rw-r--r--test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBar.test.js318
-rw-r--r--test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarActions.test.js265
-rw-r--r--test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js141
-rw-r--r--test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarTestConstants.js236
4 files changed, 960 insertions, 0 deletions
diff --git a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBar.test.js b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBar.test.js
new file mode 100644
index 0000000..d56c44b
--- /dev/null
+++ b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBar.test.js
@@ -0,0 +1,318 @@
+/*
+ * ============LICENSE_START=======================================================
+ * SPARKY (AAI UI service)
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+import {expect, deep} from 'chai';
+import React from 'react';
+import {Provider} from 'react-redux';
+import sinon from 'sinon';
+import configureStore from 'redux-mock-store';
+import thunk from 'redux-thunk';
+import {storeCreator} from 'app/AppStore.js';
+import TestUtils from 'react-dom/lib/ReactTestUtils';
+import {
+ autoCompleteSearchBarActionTypes,
+ ERROR_INVALID_SEARCH_TERMS,
+ TS_BACKEND_SEARCH_SELECTED_NODE_URL,
+ NO_MATCHES_FOUND
+} from 'generic-components/autoCompleteSearchBar/AutoCompleteSearchBarConstants.js';
+import {AutoCompleteSearchBar} from 'generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx';
+import {ERROR_RETRIEVING_DATA, POST, POST_HEADER} from 'app/networking/NetworkConstants.js';
+import {tierSupportActionTypes, TSUI_SEARCH_URL} from 'app/tierSupport/TierSupportConstants.js';
+import {TABLE_DATA} from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsConstants.js';
+import {mount, shallow} from 'enzyme';
+import i18n from 'utils/i18n/i18n';
+import {
+ queryRequestedValues,
+ clearSuggestionsTextField,
+ onSuggestionsChange,
+ onSuggestionsClearRequested,
+ querySelectedNodeElement,
+ getInvalidSearchInputEvent
+} from 'app/tierSupport/autoCompleteSearchBar/AutoCompleteSearchBarActions.js';
+import * as networkCall from 'app/networking/NetworkCalls.js';
+import autoCompleteSearchBarTestConstants from './autoCompleteSearchBarTestConstants';
+
+const middlewares = [thunk]; // add your middlewares like `redux-thunk`
+const mockStore = configureStore(middlewares);
+
+
+describe('Core AutoCompleteSearchBar suite', function() {
+
+ describe('AutoCompleteSearchBar - View test ', function() {
+ let wrapper = undefined;
+
+ beforeEach(() => {
+ wrapper = mount(
+ <AutoCompleteSearchBar
+ onSuggestionsFetchRequested={() => {}}
+ value=''
+ suggestions={[]}
+ cachedSuggestions={[]}
+ feedbackMsgText=''
+ feedbackMsgSeverity=''
+ />
+ );
+ });
+
+ function createState(currentScreen, tierSupport) {
+ return {
+ currentScreen: currentScreen,
+ tierSupport: tierSupport
+ };
+ }
+
+
+
+ it('Test flow - test onNewSearch() success test: Expect tierSupportActionTypes.TS_NODE_SEARCH_RESULTS action being passed When the selected node is found in the main database and e', done => {
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.validResponseJsonForNodeSearchFromFetchWithHits));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onSucessfullNodeDetailsFoundEvent(){
+ return {
+ type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
+ data: autoCompleteSearchBarTestConstants.validResponseJsonForNodeSearchFromFetchWithHits
+ };
+ }
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => expect(mStore.getActions()[0]).to.deep.equal(onSucessfullNodeDetailsFoundEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Test flow - test onNewSearch() failure test: Expect tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS action being passed When the selected node is not found in the main database and e', done => {
+
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.inValidResponseJsonForNodeSearchFromFetchWithHits));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onNofullNodeDetailsFoundEvent(){
+ return {
+ type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+ data: {searchTag: autoCompleteSearchBarTestConstants.nodeSearchKeyword}
+ };
+ }
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => {
+ expect(mStore.getActions()[0]).to.deep.equal(onNofullNodeDetailsFoundEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut;
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Test flow - test onNewSearch() failure: Expect tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR action being passed When Network fails', done => {
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.networkError));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onInvalidSelectedNodeSearchEvent(){
+ return {
+ type: tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR,
+ data: {value: autoCompleteSearchBarTestConstants.nodeSearchKeyword, errorMsg: ERROR_RETRIEVING_DATA}
+ };
+ }
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => {
+ expect(mStore.getActions()[0]).to.deep.equal(onInvalidSelectedNodeSearchEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut;
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+
+ it('Test flow - test onNewSearch() failure: Expect tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS action being passed When no cached suggestions are found', done => {
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').never().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.networkError));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: [],
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onInvalidSearchInputEvent(){
+ return {
+ type: tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS,
+ data: {value: autoCompleteSearchBarTestConstants.nodeSearchKeyword, errorMsg: ERROR_INVALID_SEARCH_TERMS}
+ };
+ }
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => {
+ expect(mStore.getActions()[0]).to.deep.equal(onInvalidSearchInputEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut;
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Test flow - test onNewSearch() failure: Expect no matches found When no cached suggestions does not have the node searched for', done => {
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').never().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.networkError));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType2.hits.hits,
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onInvalidSearchInputEvent(){
+ return {
+ type: tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS,
+ data: {value: autoCompleteSearchBarTestConstants.nodeSearchKeyword, errorMsg: ERROR_INVALID_SEARCH_TERMS}
+ };
+ }
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => {
+ expect(mStore.getActions()[0]).to.deep.equal(onInvalidSearchInputEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut;
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Test flow - test onNewSearch() failure: Expect no node search When no matches are found in lookup search', done => {
+ const mStore = mockStore({});
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').never().withArgs(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword).returns(Promise.resolve(autoCompleteSearchBarTestConstants.networkError));
+ let mockedNetworkFetchRequest = () => networkCall.fetchRequest(TS_BACKEND_SEARCH_SELECTED_NODE_URL, POST, POST_HEADER, autoCompleteSearchBarTestConstants.nodeSearchKeyword);
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.multipleNodeSearchKeyword,
+ suggestions: [{_source:{ entityType:i18n(NO_MATCHES_FOUND),searchTags:''}}],
+ cachedSuggestions: [{_source:{ entityType:i18n(NO_MATCHES_FOUND),searchTags:''}}],
+ onNewSearch: (searchRequestObject, value) => {
+ if (Object.keys(searchRequestObject).length === 0) {
+ mStore.dispatch(getInvalidSearchInputEvent(autoCompleteSearchBarTestConstants.nodeSearchKeyword));
+ } else {
+ mStore.dispatch(querySelectedNodeElement(searchRequestObject, autoCompleteSearchBarTestConstants.nodeSearchKeyword, mockedNetworkFetchRequest));
+ }
+ }
+
+ });
+
+ function onInvalidSearchInputEvent(){
+ return {
+ type: tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS,
+ data: {value: autoCompleteSearchBarTestConstants.nodeSearchKeyword, errorMsg: ERROR_INVALID_SEARCH_TERMS}
+ };
+
+ }
+ wrapper.find('.react-autosuggest__input').simulate('focus');
+ wrapper.find('.auto-complete-search-button').simulate('click');
+ mockNetwork.verify();
+ mockNetwork.restore();
+ setTimeout(() => {
+ expect(mStore.getActions()[0]).to.deep.equal(onInvalidSearchInputEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut;
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Expect the list to be populated when a the auto suggest input box is focused', function() {
+ const mStore = mockStore({});
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeywordWithOutEqualSign,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits,
+
+ });
+ wrapper.find('.react-autosuggest__input').simulate('focus');
+ expect(wrapper.find('Item').children()).to.have.length(6);
+ });
+
+ it('Expect small list to be populated when a the auto suggest input box is focused', function() {
+ const mStore = mockStore({});
+ wrapper.setProps({
+ value: autoCompleteSearchBarTestConstants.nodeSearchKeyword,
+ suggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType2.hits.hits,
+ cachedSuggestions: autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType2.hits.hits,
+
+ });
+ wrapper.find('.react-autosuggest__input').simulate('focus');
+ expect(wrapper.find('Item').children()).to.have.length(3);
+ });
+ });
+});
diff --git a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarActions.test.js b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarActions.test.js
new file mode 100644
index 0000000..13cfd63
--- /dev/null
+++ b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarActions.test.js
@@ -0,0 +1,265 @@
+/*
+ * ============LICENSE_START=======================================================
+ * SPARKY (AAI UI service)
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+import {expect, deep} from "chai";
+import React from "react";
+import {Provider} from "react-redux";
+import sinon from "sinon";
+import configureStore from "redux-mock-store";
+import thunk from "redux-thunk";
+import {storeCreator} from "app/AppStore.js";
+import {
+ autoCompleteSearchBarActionTypes,
+ TS_BACKEND_SEARCH_SELECTED_NODE_URL,
+ ERROR_INVALID_SEARCH_TERMS,
+ TIER_SUPPORT_NETWORK_ERROR
+} from "app/tierSupport/autoCompleteSearchBar/AutoCompleteSearchBarConstants.js";
+import {
+ searchResultsFound,
+ clearSuggestionsTextField,
+ onSuggestionsChange,
+ onSuggestionsClearRequested,
+ getInvalidSearchInputEvent,
+ fetchRequestedValues,
+ fetchSelectedNodeElement,
+ queryRequestedValues
+} from "app/tierSupport/autoCompleteSearchBar/AutoCompleteSearchBarActions.js";
+import {tierSupportActionTypes, TSUI_SEARCH_URL} from "app/tierSupport/TierSupportConstants.js";
+import {TABLE_DATA} from "app/tierSupport/selectedNodeDetails/SelectedNodeDetailsConstants.js";
+import {getDynamicTSUISearchURL} from "app/tierSupport/TierSupportActions.js";
+import * as networkCall from "app/networking/NetworkCalls.js";
+import {POST,
+ POST_HEADER,
+ ERROR_RETRIEVING_DATA} from "app/networking/NetworkConstants.js";
+import autoCompleteSearchBarTestConstants from "./autoCompleteSearchBarTestConstants";
+
+const middlewares = [thunk]; // add your middlewares like `redux-thunk`
+const mockStore = configureStore(middlewares);
+
+
+describe('Core AutoCompleteSearchBar suite', function() {
+
+ describe('AutoCompleteSearchBar - Actions test ', function() {
+
+ function createState(currentScreen, tierSupport) {
+ return {
+ currentScreen: currentScreen,
+ tierSupport: tierSupport
+ };
+ }
+
+ it('Expect CLEAR_SUGGESTIONS_TEXT_FIELD action being passed When clearSuggestionsTextField is dispatched.', function(){
+ const store = mockStore({});
+ function clearSuggestionsTextFieldSuccess() {
+ return {
+ type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD
+ }
+ }
+
+ store.dispatch(clearSuggestionsTextField());
+ expect(store.getActions()[0]).to.deep.equal(clearSuggestionsTextFieldSuccess());
+ });
+
+ it('Expect CLEAR_SUGGESTIONS action being passed When onSuggestionsClearRequested is dispatched.', function() {
+ const store = mockStore({});
+ function onSuggestionsClearRequestedSuccess() {
+ return {
+ type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS
+ }
+ }
+
+ store.dispatch(onSuggestionsClearRequested());
+ expect(store.getActions()[0]).to.deep.equal(onSuggestionsClearRequestedSuccess());
+
+ });
+
+ it('Expect TS_NODE_SEARCH_INVALID_TERMS action being passed When getInvalidSearchInputEvent is dispatched.', function(){
+ const store = mockStore({});
+ const value = 'test';
+
+ function onGetInvalidSearchInputEvent(){
+ return{
+ type: tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS,
+ data: {value: value, errorMsg: ERROR_INVALID_SEARCH_TERMS}
+ }
+ }
+
+ store.dispatch(getInvalidSearchInputEvent(value));
+ expect(store.getActions()[0]).to.deep.equal(onGetInvalidSearchInputEvent());
+
+ });
+
+ });
+
+ it('Expect SUGGESTION_CHANGED action being passed When onSuggestionsChangeSuccess is dispatched with tab key.', function() {
+ const store = mockStore({});
+ const value = 'test';
+
+ function onSuggestionsChangeSuccess() {
+ return {
+ type: autoCompleteSearchBarActionTypes.SUGGESTION_CHANGED,
+ data: value
+ }
+ }
+
+ var event = {
+ keyCode: 9
+ };
+
+ store.dispatch(onSuggestionsChange(event, value));
+ expect(store.getActions()[0]).to.deep.equal(onSuggestionsChangeSuccess());
+
+ });
+
+ it('Expect SUGGESTION_CHANGED action being passed When onSuggestionsChange is dispatched with enter key.', function() {
+ const store = mockStore({});
+ const value = 'test';
+
+ function onSuggestionsChangeSucessfull() {
+ return {type: autoCompleteSearchBarActionTypes.SUGGESTION_CHANGED, data: value};
+ }
+
+ var event = {
+ keyCode: 13
+ };
+
+ store.dispatch(onSuggestionsChange(event, value));
+ expect(store.getActions()[0]).to.deep.equal(onSuggestionsChangeSucessfull());
+ });
+
+ it('Expect fetchRequest being called once and SUGGESTION_FOUND action being when passed fetchRequestedValues is dispatched, and a valid response is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TSUI_SEARCH_URL, POST, POST_HEADER, value).returns(Promise.resolve(autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1));
+ store.dispatch(fetchRequestedValues(() => networkCall.fetchRequest(TSUI_SEARCH_URL, POST, POST_HEADER, value)));
+ mockNetwork.verify();
+ mockNetwork.restore();
+
+ function onCreateSuggestionFoundEvent() {
+ return {
+ type: autoCompleteSearchBarActionTypes.SUGGESTION_FOUND,
+ data: {suggestions : autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits }
+ };
+ }
+
+ setTimeout(() => expect(store.getActions()[0]).to.deep.equal(onCreateSuggestionFoundEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+
+
+ });
+
+ it('Expect fetchRequest being called once and SUGGESTION_NOT_FOUND action being when passed fetchRequestedValues is dispatched, and a valid response with no hits is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TSUI_SEARCH_URL, POST, POST_HEADER, value).returns(Promise.resolve(autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithOutHits));
+ store.dispatch(fetchRequestedValues(() => networkCall.fetchRequest(TSUI_SEARCH_URL, POST, POST_HEADER, value)));
+ mockNetwork.verify();
+ mockNetwork.restore();
+ function onCreateSuggestionNotFoundEvent() {
+ return {
+ type: autoCompleteSearchBarActionTypes.SUGGESTION_NOT_FOUND
+ };
+ }
+
+ setTimeout(() => expect(store.getActions()[0]).to.deep.equal(onCreateSuggestionNotFoundEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Expect fetchRequest being called once and TIER_SUPPORT_NETWORK_ERROR action being when passed fetchRequestedValues is dispatched, and network error is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TSUI_SEARCH_URL, POST, POST_HEADER, value).returns(Promise.resolve(autoCompleteSearchBarTestConstants.networkError));
+ store.dispatch(fetchRequestedValues(() => networkCall.fetchRequest(TSUI_SEARCH_URL, POST, POST_HEADER, value)));
+ mockNetwork.verify();
+ mockNetwork.restore();
+
+ function onGetInvalidQueryEvent() {
+ return {
+ type: tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR,
+ data: {value: value, errorMsg: ERROR_RETRIEVING_DATA}
+ };
+ }
+
+ setTimeout(() => {
+ expect(store.getActions()[0].type.toString()).to.equal(tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR.toString()), autoCompleteSearchBarTestConstants.mockRequestTimeOut
+ });
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Expect fetchRequest being called once and SUGGESTION_FOUND action being when passed queryRequestedValues is dispatched, and network error is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ let mockNetwork = sinon.mock(networkCall);
+ mockNetwork.expects('fetchRequest').once().withArgs(TSUI_SEARCH_URL, POST, POST_HEADER, value).returns(Promise.resolve(autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1));
+ store.dispatch(fetchRequestedValues(() => networkCall.fetchRequest(TSUI_SEARCH_URL, POST, POST_HEADER, value)));
+ mockNetwork.verify();
+ mockNetwork.restore();
+
+ function onCreateSuggestionFoundEvent() {
+ return {
+ type: autoCompleteSearchBarActionTypes.SUGGESTION_FOUND,
+ data: {suggestions : autoCompleteSearchBarTestConstants.validResponseJsonForRequestFromFetchWithHitsType1.hits.hits }
+ };
+ }
+
+ setTimeout(() => expect(store.getActions()[0]).to.deep.equal(onCreateSuggestionFoundEvent()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Expect TIER_SUPPORT_NETWORK_ERROR action being passed when clearSuggestionsTextField is dispatched with no mock, and network error is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ store.dispatch(clearSuggestionsTextField());
+
+ function onClearSuggestionsTextField() {
+ return {type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD};
+ }
+
+ setTimeout(() => expect(store.getActions()[0]).to.deep.equal(onClearSuggestionsTextField()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+
+ it('Expect CLEAR_SUGGESTIONS action being passed when onSuggestionsClearRequested is dispatched with no mock, and network error is sent in mock', done => {
+ const store = mockStore({});
+ const value = 'test';
+
+ store.dispatch(onSuggestionsClearRequested());
+
+ function onSuggestionsClearRequestedExpected() {
+ return{type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS};
+ }
+
+ setTimeout(() => expect(store.getActions()[0]).to.deep.equal(onSuggestionsClearRequestedExpected()), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ setTimeout(() => done(), autoCompleteSearchBarTestConstants.mockRequestTimeOut);
+ });
+});
diff --git a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js
new file mode 100644
index 0000000..f3f1c19
--- /dev/null
+++ b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js
@@ -0,0 +1,141 @@
+/*
+ * ============LICENSE_START=======================================================
+ * SPARKY (AAI UI service)
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+import {expect} from 'chai';
+import React from 'react';
+import {Provider} from 'react-redux';
+import TestUtils from 'react-dom/lib/ReactTestUtils';
+import {tierSupportActionTypes} from 'app/tierSupport/TierSupportConstants.js';
+import reducer from 'app/tierSupport/autoCompleteSearchBar/AutoCompleteSearchBarReducer.js';
+import {MESSAGE_LEVEL_WARNING, MESSAGE_LEVEL_DANGER} from 'utils/GlobalConstants.js';
+import {
+ autoCompleteSearchBarActionTypes,
+ NO_MATCHES_FOUND,
+ ERROR_INVALID_SEARCH_TERMS} from 'app/tierSupport/autoCompleteSearchBar/AutoCompleteSearchBarConstants.js';
+import {
+ ERROR_RETRIEVING_DATA} from 'app/networking/NetworkConstants.js';
+
+describe('AutoCompleteSearchBar - Reducer test ', function() {
+
+ const testSuggestionData = [
+ {_source:{ entityType: 'vserver',searchTags:'testing'}},
+ {_source:{ entityType: 'vserver',searchTags:'someTag'}},
+ {_source:{ entityType: 'vserver',searchTags:'test2'}}];
+
+ it('AutoCompleteSearchBar reducer - Suggestion not found', function() {
+ const feedbackMsgText = '';
+ const suggestions = [];
+ const action = {type: autoCompleteSearchBarActionTypes.SUGGESTION_NOT_FOUND};
+ const initialState = {
+ suggestions: suggestions
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.have.deep.property('[0]._source.entityType', 'No Matches Found');
+ });
+
+ it('AutoCompleteSearchBar reducer - Suggestion found', function() {
+ const feedbackMsgText = '';
+ const action =
+ {
+ type: autoCompleteSearchBarActionTypes.SUGGESTION_FOUND,
+ data: {
+ suggestions: testSuggestionData
+ }
+ };
+ const initialState = {
+ suggestions: []
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.have.deep.property('[0]._source.searchTags', 'testing');
+ expect(newState.suggestions).to.have.deep.property('[1]._source.searchTags', 'someTag');
+ expect(newState.suggestions).to.have.deep.property('[2]._source.searchTags', 'test2');
+ });
+
+ it('AutoCompleteSearchBar reducer - Clear Suggestion field', function() {
+ const feedbackMsgText = '';
+ const action = {type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD, value: 'test'};
+ const initialState = {
+ suggestions: testSuggestionData
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.be.empty;
+ expect(newState.value).to.equal('');
+ });
+
+ it('AutoCompleteSearchBar reducer - Clear Suggestions', function() {
+ const feedbackMsgText = '';
+ const action = {type: autoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS, value: 'test'};
+ const initialState = {
+ suggestions: testSuggestionData
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.be.empty;
+ });
+
+ it('AutoCompleteSearchBar reducer - Suggestions changed', function() {
+ const feedbackMsgText = '';
+ const action = {type: autoCompleteSearchBarActionTypes.SUGGESTION_CHANGED, value: 'test'};
+ const initialState = {
+ suggestions: testSuggestionData
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.have.deep.property('[0]._source.searchTags', 'testing');
+ expect(newState.suggestions).to.have.deep.property('[1]._source.searchTags', 'someTag');
+ expect(newState.suggestions).to.have.deep.property('[2]._source.searchTags', 'test2');
+ });
+
+ it('AutoCompleteSearchBar reducer - Network error', function() {
+ const feedbackMsgText = '';
+ const feedbackMsgSeverity = '';
+ const action = {type: tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR, data: {value: 'test', errorMsg: ERROR_RETRIEVING_DATA}};
+ const initialState = {
+ suggestions: testSuggestionData
+ };
+
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.be.empty;
+ expect(newState.feedbackMsgText).to.equal(ERROR_RETRIEVING_DATA);
+ expect(newState.feedbackMsgSeverity).to.equal(MESSAGE_LEVEL_DANGER);
+ });
+
+ it('AutoCompleteSearchBar reducer - TS_NODE_SEARCH_INVALID_TERMS', function(){
+ const feedbackMsgText = ERROR_INVALID_SEARCH_TERMS;
+ const action = {type: tierSupportActionTypes.TS_NODE_SEARCH_INVALID_TERMS, data: {value: 'test', errorMsg: ERROR_INVALID_SEARCH_TERMS}};
+ const initialState = {
+ suggestions: testSuggestionData
+ };
+ const newState = reducer(initialState, action);
+ expect(newState.suggestions).to.be.empty;
+ expect(newState.cachedSuggestions).to.be.empty;
+ expect(newState.feedbackMsgText).to.equal(ERROR_INVALID_SEARCH_TERMS);
+ expect(newState.feedbackMsgSeverity).to.equal(MESSAGE_LEVEL_WARNING);
+ });
+
+});
diff --git a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarTestConstants.js b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarTestConstants.js
new file mode 100644
index 0000000..f8fd893
--- /dev/null
+++ b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarTestConstants.js
@@ -0,0 +1,236 @@
+/*
+ * ============LICENSE_START=======================================================
+ * SPARKY (AAI UI service)
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+const validResponseJsonForRequestFromFetchWithHitsType1 = {
+ "took": 5,
+ "timed_out": false,
+ "_shards": {
+ "total": 5,
+ "successful": 5,
+ "failed": 0
+ },
+ "hits": {
+ "total": 9376,
+ "max_score": 3.3899312,
+ "hits": [
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
+ "_score": 3.3899312,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
+ "_score": 3.1589103,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
+ "_score": 3.147036,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost2",
+ "_type": "aaiEntities",
+ "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
+ "_score": 3.3899312,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost2",
+ "_type": "aaiEntities",
+ "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
+ "_score": 3.1589103,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost2",
+ "_type": "aaiEntities",
+ "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
+ "_score": 3.147036,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
+ "searchTagIDs": "0",
+ "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
+ }
+ }
+ ]
+ }
+};
+
+const validResponseJsonForRequestFromFetchWithHitsType2 = {
+ "took": 5,
+ "timed_out": false,
+ "_shards": {
+ "total": 5,
+ "successful": 5,
+ "failed": 0
+ },
+ "hits": {
+ "total": 9376,
+ "max_score": 3.3899312,
+ "hits": [
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
+ "_score": 3.3899312,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "entityPrimaryKeyValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
+ "searchTagIDs": "0",
+ "searchTags": "hostname-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
+ "_score": 3.1589103,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
+ "searchTagIDs": "0",
+ "searchTags": "hostname-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
+ }
+ },
+ {
+ "_index": "entitysearchindex-localhost",
+ "_type": "aaiEntities",
+ "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
+ "_score": 3.147036,
+ "_source": {
+ "entityType": "service-instance",
+ "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
+ "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
+ "searchTagIDs": "0",
+ "searchTags": "hostname-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
+ }
+ }
+ ]
+ }
+};
+
+const validResponseJsonForRequestFromFetchWithOutHits = {
+ "took": 5,
+ "timed_out": false,
+ "_shards": {
+ "total": 5,
+ "successful": 5,
+ "failed": 0
+ },
+ "hits": {
+ "total": 0,
+ "max_score": 3.3899312,
+ "hits": []
+ }
+};
+
+const networkError = {
+ "error": "Network Error"
+};
+
+const validResponseJsonForNodeSearchFromFetchWithHits = {
+ "graphMeta":{},
+ "nodes" : [ {
+ "id" : "service-instance.PRUCPEHOST0627002",
+ "itemType" : "service-instance",
+ "itemNameKey" : "service-instance.PRUCPEHOST0627002",
+ "itemNameValue" : "PRUCPEHOST0627002",
+ "itemProperties" : {
+ "resource-version" : "1467233099",
+ "service-instance-id" : "PRUCPEHOST0627002"
+ },
+ "nodeMeta" : {
+ "className" : "selectedSearchedNodeClass",
+ "nodeDebug" : null,
+ "selfLinkResponseTimeInMs" : 131,
+ "relationshipNode" : false,
+ "searchTarget" : true,
+ "enrichableNode" : false
+ }
+ } ]
+};
+
+const inValidResponseJsonForNodeSearchFromFetchWithHits = {
+ "graphMeta":{},
+ "nodes" : []
+};
+
+const nodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
+const nodeSearchKeywordWithOutEqualSign = 'a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
+const multipleNodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1, service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
+const mockRequestTimeOut = 1;
+export default{
+ validResponseJsonForRequestFromFetchWithHitsType1: validResponseJsonForRequestFromFetchWithHitsType1,
+ validResponseJsonForRequestFromFetchWithHitsType2: validResponseJsonForRequestFromFetchWithHitsType2,
+ validResponseJsonForRequestFromFetchWithOutHits: validResponseJsonForRequestFromFetchWithOutHits,
+ networkError: networkError,
+ validResponseJsonForNodeSearchFromFetchWithHits: validResponseJsonForNodeSearchFromFetchWithHits,
+ inValidResponseJsonForNodeSearchFromFetchWithHits: inValidResponseJsonForNodeSearchFromFetchWithHits,
+ nodeSearchKeyword: nodeSearchKeyword,
+ nodeSearchKeywordWithOutEqualSign: nodeSearchKeywordWithOutEqualSign,
+ multipleNodeSearchKeyword: multipleNodeSearchKeyword,
+ mockRequestTimeOut: mockRequestTimeOut
+};