mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
correct loading value and resulting tests
This commit is contained in:
@@ -219,8 +219,12 @@ export default function reducer(state: any = {}, action: any = {}) {
|
|||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FETCH_USERS:
|
case FETCH_USERS:
|
||||||
return {
|
return {
|
||||||
loading: true,
|
...state,
|
||||||
error: null
|
users: {
|
||||||
|
error: null,
|
||||||
|
entries: null,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
};
|
};
|
||||||
case DELETE_USER:
|
case DELETE_USER:
|
||||||
return {
|
return {
|
||||||
@@ -246,13 +250,17 @@ export default function reducer(state: any = {}, action: any = {}) {
|
|||||||
usersByNames
|
usersByNames
|
||||||
};
|
};
|
||||||
case FETCH_USERS_FAILURE:
|
case FETCH_USERS_FAILURE:
|
||||||
case DELETE_USER_FAILURE:
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
login: false,
|
|
||||||
error: action.payload,
|
error: action.payload,
|
||||||
loading: false
|
loading: false
|
||||||
};
|
};
|
||||||
|
case DELETE_USER_FAILURE:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
error: action.payload,
|
||||||
|
loading: false
|
||||||
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -157,8 +157,8 @@ describe("fetch tests", () => {
|
|||||||
describe("reducer tests", () => {
|
describe("reducer tests", () => {
|
||||||
test("users request", () => {
|
test("users request", () => {
|
||||||
var newState = reducer({}, { type: FETCH_USERS });
|
var newState = reducer({}, { type: FETCH_USERS });
|
||||||
expect(newState.loading).toBeTruthy();
|
expect(newState.users.loading).toBeTruthy();
|
||||||
expect(newState.error).toBeNull();
|
expect(newState.users.error).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("fetch users successful", () => {
|
test("fetch users successful", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user