cebddb357a522a3d90ccb9a05ff7924a0476bb5e
[sdc/sdc-workflow-designer.git] /
1 /*
2 * Copyright © 2018 European Support Limited
3 *
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
7 *
8 *      http: //www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 'use strict';
18
19 import catalogReducer, { initialState } from 'features/catalog/catalogReducer';
20 import { update } from 'features/catalog/catalogActions';
21
22 describe('Catalog Reducer', () => {
23     it('returns the initial state', () => {
24         expect(catalogReducer(undefined, {})).toEqual(initialState);
25     });
26
27     it('returns correct state for workflows update action', () => {
28         const payload = {
29             total: 2,
30             size: 100,
31             page: 0,
32             results: [
33                 {
34                     id: '755eab7752374a2380544065b59b082d',
35                     name: 'Alfa',
36                     description: 'description description 1',
37                     category: null
38                 },
39                 {
40                     id: 'ef8159204dac4c10a85b29ec30b4bd56',
41                     name: 'Bravo',
42                     description: 'description description 2',
43                     category: null
44                 }
45             ]
46         };
47
48         const action = update(payload);
49
50         expect(catalogReducer(initialState, action).workflows).toEqual(payload);
51     });
52 });