Fix setting active side panel item on page reload
[arvados-workbench2.git] / src / store / side-panel / side-panel-reducer.test.ts
index 21c10cc64540a1889d963a284195570d584d31f3..7210e1810a35d2f208bfebad5520b2c34fc35633 100644 (file)
@@ -2,81 +2,31 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import sidePanelReducer from "./side-panel-reducer";
-import actions from "./side-panel-action";
-import { IconTypes } from "../../components/icon/icon";
+import { sidePanelReducer } from "./side-panel-reducer";
+import { sidePanelActions } from "./side-panel-action";
+import { ProjectsIcon } from "~/components/icon/icon";
 
 describe('side-panel-reducer', () => {
-
-    it('should toggle activity on side-panel', () => {
-        const initialState = [
-            {
-                id: "1",
-                name: "Projects",
-                icon: IconTypes.INBOX,
-                open: false,
-                active: false,
-            }
-        ];
-        const project = [
-            {
-                id: "1",
-                name: "Projects",
-                icon: IconTypes.INBOX,
-                open: false,
-                active: true,
-            }
-        ];
-
-        const state = sidePanelReducer(initialState, actions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(initialState[0].id));
-        expect(state).toEqual(project);
-    });
-
     it('should open side-panel item', () => {
         const initialState = [
             {
                 id: "1",
                 name: "Projects",
-                icon: IconTypes.INBOX,
-                open: false,
-                active: false,
-            }
-        ];
-        const project = [
-            {
-                id: "1",
-                name: "Projects",
-                icon: IconTypes.INBOX,
-                open: true,
-                active: false,
-            }
-        ];
-
-        const state = sidePanelReducer(initialState, actions.TOGGLE_SIDE_PANEL_ITEM_OPEN(initialState[0].id));
-        expect(state).toEqual(project);
-    });
-
-    it('should remove activity on side-panel item', () => {
-        const initialState = [
-            {
-                id: "1",
-                name: "Projects",
-                icon: IconTypes.INBOX,
-                open: false,
-                active: true,
+                url: "/projects",
+                icon: ProjectsIcon,
+                open: false
             }
         ];
         const project = [
             {
                 id: "1",
                 name: "Projects",
-                icon: IconTypes.INBOX,
-                open: false,
-                active: false,
+                icon: ProjectsIcon,
+                open: true
             }
         ];
 
-        const state = sidePanelReducer(initialState, actions.RESET_SIDE_PANEL_ACTIVITY(initialState[0].id));
+        const state = sidePanelReducer(initialState, sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(initialState[0].id));
         expect(state).toEqual(project);
     });
-});
\ No newline at end of file
+});