diff options
author | Steve Thomas <steventh@amdocs.com> | 2018-03-29 14:41:43 -0400 |
---|---|---|
committer | Steven Thomas <steve.thomas@amdocs.com> | 2018-03-29 14:57:35 -0400 |
commit | 0b2b11bad1457e7f388ab2a99af6ebf231e862e3 (patch) | |
tree | 8ef541c5b172893ca9b952cf251a7a78668ab6f1 /test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js | |
parent | 47b85e9b95e0a0a3570f0cea4d3ee4645c911a8b (diff) |
increasing test coverage to 10%
Issue-ID: AAI-980
Change-Id: Idb816df11fa14b5668349f24bac1aafd7235e00a
Signed-off-by: Steven Thomas <steve.thomas@amdocs.com>
Diffstat (limited to 'test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js')
-rw-r--r-- | test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js b/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js deleted file mode 100644 index a4c35e6..0000000 --- a/test/tierSupport/autoCompleteSearchBar/autoCompleteSearchBarReducer.test.js +++ /dev/null @@ -1,136 +0,0 @@ -/*
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ================================================================================
- * 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=========================================================
- */
-import {expect} from 'chai';
-import React from 'react';
-import {Provider} from 'react-redux';
-import TestUtils from 'react-dom/test-utils';
-import {tierSupportActionTypes} from 'app/tierSupport/TierSupportConstants.js';
-import reducer from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.js';
-import {MESSAGE_LEVEL_WARNING, MESSAGE_LEVEL_DANGER} from 'utils/GlobalConstants.js';
-import {
- autoCompleteSearchBarActionTypes,
- NO_MATCHES_FOUND,
- ERROR_INVALID_SEARCH_TERMS} from 'generic-components/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);
- });
-
-});
|