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 () => ({
state: {
endpoints: {},
activeTab: null,
mrMetadata: {},
},
actions,
getters,
......
export default {
SET_ACTIVE_TAB: 'SET_ACTIVE_TAB',
SET_ENDPOINTS: 'SET_ENDPOINTS',
SET_MR_METADATA: 'SET_MR_METADATA',
};
......@@ -7,4 +7,7 @@ export default {
[types.SET_ENDPOINTS](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', () => {
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