1 import SelectedNodeDetailsReducer from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsReducer.js';
2 import {tierSupportActionTypes} from 'app/tierSupport/TierSupportConstants.js';
4 globalAutoCompleteSearchBarActionTypes
5 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
7 describe('SelectedNodeDetails - Reducer Tests', () => {
8 it('Action Type: TS_NODE_SEARCH_RESULTS', () => {
10 type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
14 'id': 'AAI/CLYMR/000509/SD_WAN',
15 'itemType': 'service-instance',
16 'itemNameKey': 'service-instance.AAI/SPRKY/000509/SD_WAN',
17 'itemNameValue': 'AAI/SPRKY/000509/SD_WAN',
19 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
20 'resource-version':'1508078039815'
23 'entityId' : 'AEEhny_vnf1_under_fw-si1',
25 'entityLink' : 'cloud-infrastr084-1377-4f49-9c72-f0_location2',
26 'initialTimestamp' :'2017-11-13T16:58:01Z',
27 'latestValidationTimestamp':'2017-11-13T16:58:01Z',
28 'resourceVersion':'1510592264096',
32 'className': 'selectedSearchedNodeClass',
34 'selfLinkResponseTimeInMs': 628,
35 'relationshipNode': false,
37 'enrichableNode': false,
38 'nodeValidated': true,
41 'nodeType': 'serviceInstance',
42 'nodeLabel1':'service-instance',
43 'nodeLabel2':'AAI/SPRKY/000509/SD_WAN'
55 state = SelectedNodeDetailsReducer(state, action);
56 expect(state).toEqual({
57 nodeType: action['data']['nodes'][0]['itemType'],
58 uid: action['data']['nodes'][0]['itemNameValue'],
59 nodeData: action['data']['nodes'][0]['itemProperties']
63 it('Action Type: TS_NODE_SEARCH_RESULTS - searchTarget === false', () => {
65 type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
69 'id': 'AAI/CLYMR/000509/SD_WAN',
70 'itemType': 'service-instance',
71 'itemNameKey': 'service-instance.AAI/SPRKY/000509/SD_WAN',
72 'itemNameValue': 'AAI/SPRKY/000509/SD_WAN',
74 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
75 'resource-version':'1508078039815'
78 'entityId' : 'AEEhny_vnf1_under_fw-si1',
80 'entityLink' : 'cloud-infrastr084-1377-4f49-9c72-f0_location2',
81 'initialTimestamp' :'2017-11-13T16:58:01Z',
82 'latestValidationTimestamp':'2017-11-13T16:58:01Z',
83 'resourceVersion':'1510592264096',
87 'className': 'selectedSearchedNodeClass',
89 'selfLinkResponseTimeInMs': 628,
90 'relationshipNode': false,
91 'searchTarget': false,
92 'enrichableNode': false,
93 'nodeValidated': true,
96 'nodeType': 'serviceInstance',
97 'nodeLabel1':'service-instance',
98 'nodeLabel2':'AAI/SPRKY/000509/SD_WAN'
109 'service-instance-id': 'blah/blah/blah',
110 'resource-version':'123456'
113 state = SelectedNodeDetailsReducer(state, action);
114 expect(state).toEqual({
121 it('Action Type: TS_GRAPH_NODE_SELECTED', () => {
123 type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
126 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
127 'resource-version':'1508078039815'
130 itemNameValue: '123456'
138 state = SelectedNodeDetailsReducer(state, action);
139 expect(state).toEqual({
140 nodeType: action['data']['itemType'],
141 uid: action['data']['itemNameValue'],
142 nodeData: action['data']['itemProperties']
146 it('Action Type: TIER_SUPPORT_NETWORK_ERROR', () => {
148 type: tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR,
154 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
155 'resource-version':'1508078039815'
158 state = SelectedNodeDetailsReducer(state, action);
159 expect(state).toEqual({
166 it('Action Type: TIER_SUPPORT_CLEAR_DATA', () => {
168 type: tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA,
174 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
175 'resource-version':'1508078039815'
178 state = SelectedNodeDetailsReducer(state, action);
179 expect(state).toEqual({
186 it('Action Type: TS_NODE_SEARCH_NO_RESULTS', () => {
188 type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
194 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
195 'resource-version':'1508078039815'
198 state = SelectedNodeDetailsReducer(state, action);
199 expect(state).toEqual({
206 it('Action Type: SEARCH_WARNING_EVENT', () => {
208 type: globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT,
214 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
215 'resource-version':'1508078039815'
218 state = SelectedNodeDetailsReducer(state, action);
219 expect(state).toEqual({
226 it('Invalid Action Type', () => {
228 type: 'Nonexistent Action Type',
234 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
235 'resource-version':'1508078039815'
238 state = SelectedNodeDetailsReducer(state, action);
239 expect(state).toEqual({
243 'service-instance-id': 'AAI/SPRKY/000509/SD_WAN',
244 'resource-version':'1508078039815'