mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
correct structure of config state part
This commit is contained in:
@@ -60,10 +60,8 @@ function reducer(state: any = {}, action: any = {}) {
|
||||
case FETCH_CONFIG_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
config: {
|
||||
entries: action.payload,
|
||||
configUpdatePermission: action.payload._links.update ? true : false
|
||||
}
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
||||
@@ -100,7 +100,7 @@ describe("config reducer", () => {
|
||||
it("should update state correctly according to FETCH_CONFIG_SUCCESS action", () => {
|
||||
const newState = reducer({}, fetchConfigSuccess(config));
|
||||
|
||||
expect(newState.config).toEqual({
|
||||
expect(newState).toEqual({
|
||||
entries: config,
|
||||
configUpdatePermission: true
|
||||
});
|
||||
@@ -109,12 +109,12 @@ describe("config reducer", () => {
|
||||
it("should set configUpdatePermission to true if update link is present", () => {
|
||||
const newState = reducer({}, fetchConfigSuccess(config));
|
||||
|
||||
expect(newState.config.configUpdatePermission).toBeTruthy();
|
||||
expect(newState.configUpdatePermission).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should update state according to FETCH_GROUP_SUCCESS action", () => {
|
||||
it("should update state according to FETCH_CONFIG_SUCCESS action", () => {
|
||||
const newState = reducer({}, fetchConfigSuccess(config));
|
||||
expect(newState.config.entries).toBe(config);
|
||||
expect(newState.entries).toBe(config);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user