correct structure of config state part

This commit is contained in:
Maren Süwer
2018-08-09 13:05:59 +02:00
parent e0063c5119
commit b0c1b64c43
2 changed files with 6 additions and 8 deletions

View File

@@ -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;

View File

@@ -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);
});
});