Commit a61e5877 authored by Fernando's avatar Fernando

Implement code review suggestions

* Tweak mutations and update unit tests
parent 4075c2e6
...@@ -6,12 +6,15 @@ export default { ...@@ -6,12 +6,15 @@ export default {
}, },
[types.REQUEST_SECURITY_CONFIGURATION](state) { [types.REQUEST_SECURITY_CONFIGURATION](state) {
state.isLoading = true; state.isLoading = true;
state.errorLoading = false;
}, },
[types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS](state, payload) { [types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS](state, payload) {
state.isLoading = false; state.isLoading = false;
state.errorLoading = false;
state.configuration = payload; state.configuration = payload;
}, },
[types.RECEIVE_SECURITY_CONFIGURATION_ERROR](state) { [types.RECEIVE_SECURITY_CONFIGURATION_ERROR](state) {
state.isLoading = false; state.isLoading = false;
state.errorLoading = true;
}, },
}; };
...@@ -21,6 +21,7 @@ describe('security configuration module mutations', () => { ...@@ -21,6 +21,7 @@ describe('security configuration module mutations', () => {
it('should set the isLoading to true', () => { it('should set the isLoading to true', () => {
mutations[types.REQUEST_SECURITY_CONFIGURATION](state); mutations[types.REQUEST_SECURITY_CONFIGURATION](state);
expect(state.isLoading).toBe(true); expect(state.isLoading).toBe(true);
expect(state.errorLoading).toBe(false);
}); });
}); });
...@@ -29,6 +30,7 @@ describe('security configuration module mutations', () => { ...@@ -29,6 +30,7 @@ describe('security configuration module mutations', () => {
const configuration = {}; const configuration = {};
mutations[types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS](state, configuration); mutations[types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS](state, configuration);
expect(state.isLoading).toBe(false); expect(state.isLoading).toBe(false);
expect(state.errorLoading).toBe(false);
expect(state.configuration).toBe(configuration); expect(state.configuration).toBe(configuration);
}); });
}); });
...@@ -37,6 +39,7 @@ describe('security configuration module mutations', () => { ...@@ -37,6 +39,7 @@ describe('security configuration module mutations', () => {
it('should set the isLoading to false', () => { it('should set the isLoading to false', () => {
mutations[types.RECEIVE_SECURITY_CONFIGURATION_ERROR](state); mutations[types.RECEIVE_SECURITY_CONFIGURATION_ERROR](state);
expect(state.isLoading).toBe(false); expect(state.isLoading).toBe(false);
expect(state.errorLoading).toBe(true);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment