Commit 84c9a3d3 authored by Thomas Randolph's avatar Thomas Randolph

Add a mutation that sets endpoints into the MR Notes state

parent ac808b75
...@@ -4,6 +4,7 @@ import mutations from '../mutations'; ...@@ -4,6 +4,7 @@ import mutations from '../mutations';
export default () => ({ export default () => ({
state: { state: {
endpoints: {},
activeTab: null, activeTab: null,
}, },
actions, actions,
......
export default { export default {
SET_ACTIVE_TAB: 'SET_ACTIVE_TAB', SET_ACTIVE_TAB: 'SET_ACTIVE_TAB',
SET_ENDPOINTS: 'SET_ENDPOINTS',
}; };
...@@ -4,4 +4,7 @@ export default { ...@@ -4,4 +4,7 @@ export default {
[types.SET_ACTIVE_TAB](state, tab) { [types.SET_ACTIVE_TAB](state, tab) {
Object.assign(state, { activeTab: tab }); Object.assign(state, { activeTab: tab });
}, },
[types.SET_ENDPOINTS](state, endpoints) {
Object.assign(state, { endpoints });
},
}; };
import mutationTypes from '~/mr_notes/stores/mutation_types';
import mutations from '~/mr_notes/stores/mutations';
describe('MR Notes Mutations', () => {
describe(mutationTypes.SET_ENDPOINTS, () => {
it('should set the endpoints value', () => {
const state = {};
const endpoints = { endpointA: 'A', endpointB: 'B' };
mutations[mutationTypes.SET_ENDPOINTS](state, endpoints);
expect(state.endpoints.endpointA).toBe('A');
expect(state.endpoints.endpointB).toBe('B');
});
});
});
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