X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/4beb141298fce3da40f07e1a0a08f29ac28dfd09..9dcc70fc137fac02991f3ebe830748badb4eab35:/src/store/project/project-reducer.test.ts diff --git a/src/store/project/project-reducer.test.ts b/src/store/project/project-reducer.test.ts index 65a856bd..c80f18c8 100644 --- a/src/store/project/project-reducer.test.ts +++ b/src/store/project/project-reducer.test.ts @@ -21,7 +21,7 @@ describe('project-reducer', () => { }; const state = projectsReducer(initialState, actions.CREATE_PROJECT(project)); - expect(state).toEqual([project]); + expect(state.items[0].data).toEqual(project); }); it('should load projects', () => { @@ -38,22 +38,25 @@ describe('project-reducer', () => { const projects = [project, project]; const state = projectsReducer(initialState, actions.PROJECTS_SUCCESS({ projects, parentItemId: undefined })); - expect(state).toEqual([{ - active: false, - open: false, - id: "test123", - items: [], - data: project, - status: 0 - }, { - active: false, - open: false, - id: "test123", - items: [], - data: project, - status: 0 - } - ]); + expect(state).toEqual({ + items: [{ + active: false, + open: false, + id: "test123", + items: [], + data: project, + status: 0 + }, { + active: false, + open: false, + id: "test123", + items: [], + data: project, + status: 0 + } + ], + currentItemId: "" + }); }); it('should remove activity on projects list', () => { @@ -91,10 +94,10 @@ describe('project-reducer', () => { active: false, status: 1 }], - currentItemId: "1" + currentItemId: "" }; - const state = projectsReducer(initialState, actions.RESET_PROJECT_TREE_ACTIVITY(initialState[0].id)); + const state = projectsReducer(initialState, actions.RESET_PROJECT_TREE_ACTIVITY(initialState.items[0].id)); expect(state).toEqual(project); }); @@ -126,17 +129,18 @@ describe('project-reducer', () => { modifiedAt: '2018-01-01', ownerUuid: 'owner-test123', uuid: 'test123', - kind: ResourceKind.PROJECT + kind: ResourceKind.PROJECT, }, id: "1", open: true, active: true, - status: 1 + status: 1, + toggled: true }], currentItemId: "1" }; - const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(initialState[0].id)); + const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(initialState.items[0].id)); expect(state).toEqual(project); }); @@ -181,7 +185,7 @@ describe('project-reducer', () => { currentItemId: "1" }; - const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_OPEN(initialState[0].id)); + const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_OPEN(initialState.items[0].id)); expect(state).toEqual(project); }); });