mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
restructured code/added tests
This commit is contained in:
@@ -30,7 +30,9 @@ import {
|
||||
addUserFailure,
|
||||
updateUserFailure,
|
||||
deleteUserSuccess,
|
||||
failedToFetchUsers
|
||||
failedToFetchUsers,
|
||||
requestUser,
|
||||
fetchUserFailure
|
||||
} from "./users";
|
||||
|
||||
import reducer from "./users";
|
||||
@@ -404,4 +406,17 @@ describe("users reducer", () => {
|
||||
expect(newState.users.loading).toBeFalsy();
|
||||
expect(newState.users.error).toEqual(new Error("kaputt kaputt"));
|
||||
});
|
||||
|
||||
it("should update state according to FETCH_USER action", () => {
|
||||
const newState = reducer({}, requestUser("zaphod"));
|
||||
expect(newState.usersByNames["zaphod"].loading).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should uppdate state according to FETCH_USER_FAILURE action", () => {
|
||||
const newState = reducer(
|
||||
{},
|
||||
fetchUserFailure(userFord, new Error("kaputt!"))
|
||||
);
|
||||
expect(newState.usersByNames["ford"].error).toBeTruthy;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user