Commit 17c3dcf6 authored by Thomas Randolph's avatar Thomas Randolph

Add a mutation to set the MR Metadata into state

parent 8de1bc8a
...@@ -6,6 +6,7 @@ export default () => ({ ...@@ -6,6 +6,7 @@ export default () => ({
state: { state: {
endpoints: {}, endpoints: {},
activeTab: null, activeTab: null,
mrMetadata: {},
}, },
actions, actions,
getters, getters,
......
export default { export default {
SET_ACTIVE_TAB: 'SET_ACTIVE_TAB', SET_ACTIVE_TAB: 'SET_ACTIVE_TAB',
SET_ENDPOINTS: 'SET_ENDPOINTS', SET_ENDPOINTS: 'SET_ENDPOINTS',
SET_MR_METADATA: 'SET_MR_METADATA',
}; };
...@@ -7,4 +7,7 @@ export default { ...@@ -7,4 +7,7 @@ export default {
[types.SET_ENDPOINTS](state, endpoints) { [types.SET_ENDPOINTS](state, endpoints) {
Object.assign(state, { endpoints }); Object.assign(state, { endpoints });
}, },
[types.SET_MR_METADATA](state, metadata) {
Object.assign(state, { mrMetadata: metadata });
},
}; };
...@@ -12,4 +12,16 @@ describe('MR Notes Mutations', () => { ...@@ -12,4 +12,16 @@ describe('MR Notes Mutations', () => {
expect(state.endpoints).toEqual(endpoints); expect(state.endpoints).toEqual(endpoints);
}); });
}); });
describe(mutationTypes.SET_MR_METADATA, () => {
it('store the provided MR Metadata in the state', () => {
const state = {};
const metadata = { propA: 'A', propB: 'B' };
mutations[mutationTypes.SET_MR_METADATA](state, metadata);
expect(state.mrMetadata.propA).toBe('A');
expect(state.mrMetadata.propB).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