From b41c2627977b0fb5eae44f57570d065f1634b99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Tue, 17 Jul 2018 15:06:12 +0200 Subject: [PATCH] correct loading value and resulting tests --- scm-ui/src/users/modules/users.js | 18 +++++++++++++----- scm-ui/src/users/modules/users.test.js | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scm-ui/src/users/modules/users.js b/scm-ui/src/users/modules/users.js index 2e1b3686f4..1d14f8cb33 100644 --- a/scm-ui/src/users/modules/users.js +++ b/scm-ui/src/users/modules/users.js @@ -219,8 +219,12 @@ export default function reducer(state: any = {}, action: any = {}) { switch (action.type) { case FETCH_USERS: return { - loading: true, - error: null + ...state, + users: { + error: null, + entries: null, + loading: true + } }; case DELETE_USER: return { @@ -246,13 +250,17 @@ export default function reducer(state: any = {}, action: any = {}) { usersByNames }; case FETCH_USERS_FAILURE: - case DELETE_USER_FAILURE: return { ...state, - login: false, error: action.payload, loading: false - }; + }; + case DELETE_USER_FAILURE: + return { + ...state, + error: action.payload, + loading: false + }; default: return state; diff --git a/scm-ui/src/users/modules/users.test.js b/scm-ui/src/users/modules/users.test.js index 4f4073e7a9..8d4db41985 100644 --- a/scm-ui/src/users/modules/users.test.js +++ b/scm-ui/src/users/modules/users.test.js @@ -157,8 +157,8 @@ describe("fetch tests", () => { describe("reducer tests", () => { test("users request", () => { var newState = reducer({}, { type: FETCH_USERS }); - expect(newState.loading).toBeTruthy(); - expect(newState.error).toBeNull(); + expect(newState.users.loading).toBeTruthy(); + expect(newState.users.error).toBeNull(); }); test("fetch users successful", () => {