f49c2fdc7ce1f8a515aec5cdf462997d526461e7
[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 {
20     FETCH_WORKFLOW,
21     UPDATE_WORKFLOW,
22     RESET_WORKFLOW,
23     PAGE_SIZE,
24     NAME,
25     ASC
26 } from 'features/catalog/catalogConstants';
27 import {
28     fetchWorkflow,
29     updateWorkflow,
30     resetWorkflow
31 } from 'features/catalog/catalogActions';
32
33 describe('Catalog Actions', () => {
34     it('should have `fetchWorkflow` action', () => {
35         const sort = { [NAME]: ASC };
36         const page = 0;
37
38         expect(fetchWorkflow(sort, page)).toEqual({
39             type: FETCH_WORKFLOW,
40             payload: {
41                 sort,
42                 size: PAGE_SIZE,
43                 page
44             }
45         });
46     });
47
48     it('should have `updateWorkflow` action', () => {
49         const payload = {
50             results: [],
51             total: 0,
52             page: 0,
53             size: 0,
54             sort: {
55                 name: 'asc'
56             }
57         };
58
59         expect(updateWorkflow(payload)).toEqual({
60             type: UPDATE_WORKFLOW,
61             payload
62         });
63     });
64
65     it('should have `resetWorkflow` action', () => {
66         expect(resetWorkflow()).toEqual({
67             type: RESET_WORKFLOW
68         });
69     });
70 });