2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
30 } from 'features/version/inputOutput/inputOutputConstants';
42 } from 'features/version/inputOutput/inputOutputActions';
44 describe('Input/Output Actions', () => {
45 it('should have `setInputsOutputs` action', () => {
63 type: SET_INPUTS_OUTPUTS,
70 expect(setInputsOutputs({ inputs, outputs })).toEqual(expected);
73 it('should have `changeError` action', () => {
74 const payload = { key: 'value' };
76 const expected = { type: CHANGE_ERROR, payload };
78 expect(changeError(payload)).toEqual(expected);
81 it('should have `showInputs` action', () => {
82 const expected = { type: SHOW_INPUTS };
84 expect(showInputs()).toEqual(expected);
87 it('should have `showOutputs` action', () => {
88 const expected = { type: SHOW_OUTPUTS };
90 expect(showOutputs()).toEqual(expected);
93 it('should have `search` action', () => {
94 const payload = 'Search Value';
96 const expected = { type: SEARCH, payload };
98 expect(search(payload)).toEqual(expected);
101 it('should have `add` action', () => {
102 const expected = { type: ADD };
104 expect(add()).toEqual(expected);
107 it('should have `changeName` action', () => {
108 let name = 'This is a long name more that more more more and more';
114 name: name.substr(0, NAME_MAX_LEN),
119 expect(changeName(name, key)).toEqual(expected);
122 it('should have `changeType` action', () => {
123 const type = 'String';
126 const expected = { type: CHANGE_TYPE, payload: { type, key } };
128 expect(changeType(type, key)).toEqual(expected);
131 it('should have `changeMandatory` action', () => {
132 const mandatory = true;
136 type: CHANGE_MANDATORY,
137 payload: { mandatory, key }
140 expect(changeMandatory(mandatory, key)).toEqual(expected);
143 it('should have `remove` action', () => {
146 const expected = { type: REMOVE, payload };
148 expect(remove(payload)).toEqual(expected);