merge conflicts
[arvados-workbench2.git] / src / store / side-panel / side-panel-reducer.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { sidePanelReducer } from "./side-panel-reducer";
6 import { sidePanelActions } from "./side-panel-action";
7 import { ProjectsIcon } from "../../components/icon/icon";
8
9 describe('side-panel-reducer', () => {
10
11     it('should toggle activity on side-panel', () => {
12         const initialState = [
13             {
14                 id: "1",
15                 name: "Projects",
16                 icon: ProjectsIcon,
17                 open: false,
18                 active: false,
19             }
20         ];
21         const project = [
22             {
23                 id: "1",
24                 name: "Projects",
25                 icon: ProjectsIcon,
26                 open: false,
27                 active: true,
28             }
29         ];
30
31         const state = sidePanelReducer(initialState, sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(initialState[0].id));
32         expect(state).toEqual(project);
33     });
34
35     it('should open side-panel item', () => {
36         const initialState = [
37             {
38                 id: "1",
39                 name: "Projects",
40                 icon: ProjectsIcon,
41                 open: false,
42                 active: false,
43             }
44         ];
45         const project = [
46             {
47                 id: "1",
48                 name: "Projects",
49                 icon: ProjectsIcon,
50                 open: true,
51                 active: false,
52             }
53         ];
54
55         const state = sidePanelReducer(initialState, sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(initialState[0].id));
56         expect(state).toEqual(project);
57     });
58
59     it('should remove activity on side-panel item', () => {
60         const initialState = [
61             {
62                 id: "1",
63                 name: "Projects",
64                 icon: ProjectsIcon,
65                 open: false,
66                 active: true,
67             }
68         ];
69         const project = [
70             {
71                 id: "1",
72                 name: "Projects",
73                 icon: ProjectsIcon,
74                 open: false,
75                 active: false,
76             }
77         ];
78
79         const state = sidePanelReducer(initialState, sidePanelActions.RESET_SIDE_PANEL_ACTIVITY(initialState[0].id));
80         expect(state).toEqual(project);
81     });
82 });