Migrate sdc-sdc-workflow-designer docs
[sdc/sdc-workflow-designer.git] / sdc-workflow-designer-ui / src / main / frontend / src / features / workflow / overview / __tests__ / overviewReducer-test.js
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 import overviewReducer from '../overviewReducer';
18 import { versionListFetchAction } from '../overviewConstansts';
19
20 describe('Overview reducer', () => {
21     it('check fetch versions', () => {
22         const versionResponse = {
23             total: 2,
24             size: 0,
25             page: 0,
26             items: [
27                 {
28                     id: '99adf5bc36764628b8018033d285b591',
29                     name: '1.0',
30                     description: 'Initial versionewewe',
31                     baseId: '',
32                     state: 'CERTIFIED',
33                     inputs: [
34                         {
35                             id: '08274a71d7e34d4e96878aa5fb1ed9bd',
36                             name: 'wewe',
37                             type: 'INTEGER',
38                             mandatory: true
39                         },
40                         {
41                             id: '7a0b9e33ea0244c2a05c03b96207f1c8',
42                             name: 'eee',
43                             type: 'BOOLEAN',
44                             mandatory: false
45                         }
46                     ],
47                     outputs: [
48                         {
49                             id: 'a5314bbd67ff4e6091385aaa82ebb266',
50                             name: 'e',
51                             type: 'FLOAT',
52                             mandatory: false
53                         }
54                     ],
55                     creationTime: '2018-07-25T07:36:10.112+0000',
56                     modificationTime: '2018-07-25T07:36:48.663+0000'
57                 },
58                 {
59                     id: 'cd8156bfb250475dac1e2681a9f2a74f',
60                     name: '2.0',
61                     description: 'versio2neee',
62                     baseId: '99adf5bc36764628b8018033d285b591',
63                     state: 'CERTIFIED',
64                     inputs: [
65                         {
66                             id: '08274a71d7e34d4e96878aa5fb1ed9bd',
67                             name: 'wewe',
68                             type: 'INTEGER',
69                             mandatory: true
70                         },
71                         {
72                             id: '7a0b9e33ea0244c2a05c03b96207f1c8',
73                             name: 'eee',
74                             type: 'BOOLEAN',
75                             mandatory: false
76                         }
77                     ],
78                     outputs: [
79                         {
80                             id: 'a5314bbd67ff4e6091385aaa82ebb266',
81                             name: 'e',
82                             type: 'FLOAT',
83                             mandatory: false
84                         }
85                     ],
86                     creationTime: '2018-07-25T07:36:58.978+0000',
87                     modificationTime: '2018-07-25T07:37:09.041+0000'
88                 }
89             ]
90         };
91
92         expect(
93             overviewReducer([], versionListFetchAction(versionResponse))
94         ).toEqual([...versionResponse.items]);
95     });
96 });