15a9c8c5b5e2cea7d9ef71e0df924d0bc692b4dc
[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 import {
18     UPDATE,
19     SCROLL,
20     SORT,
21     LIMIT,
22     NAME,
23     ASC
24 } from 'features/catalog/catalogConstants';
25 import { update, scroll, sort } from 'features/catalog/catalogActions';
26
27 describe('Catalog Actions', () => {
28     it('show have `update` action', () => {
29         expect(update()).toEqual({
30             type: UPDATE
31         });
32     });
33
34     it('show have `scroll` action', () => {
35         const page = 1;
36         const sort = {};
37
38         const expected = {
39             type: SCROLL,
40             payload: {
41                 page,
42                 sort,
43                 size: LIMIT
44             }
45         };
46
47         expect(scroll(page, sort)).toEqual(expected);
48     });
49
50     it('show have `sort` action', () => {
51         const sortPayload = {
52             [NAME]: ASC
53         };
54
55         const expected = {
56             type: SORT,
57             payload: {
58                 sort: sortPayload
59             }
60         };
61
62         expect(sort(sortPayload)).toEqual(expected);
63     });
64 });