summaryrefslogtreecommitdiff
path: root/spec/frontend/mr_notes/stores/mutations_spec.js
blob: 35b8a2e4be284471aa1735ae080ae908a8ea847b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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).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');
    });
  });
});