summaryrefslogtreecommitdiff
path: root/spec/frontend/grafana_integration/store/mutations_spec.js
blob: 18e8739418932848836ad23e49c737048ad0c633 (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
28
29
30
31
32
33
34
35
import mutations from '~/grafana_integration/store/mutations';
import createState from '~/grafana_integration/store/state';

describe('grafana integration mutations', () => {
  let localState;

  beforeEach(() => {
    localState = createState();
  });

  describe('SET_GRAFANA_URL', () => {
    it('sets grafanaUrl', () => {
      const mockUrl = 'mockUrl';
      mutations.SET_GRAFANA_URL(localState, mockUrl);

      expect(localState.grafanaUrl).toBe(mockUrl);
    });
  });

  describe('SET_GRAFANA_TOKEN', () => {
    it('sets grafanaToken', () => {
      const mockToken = 'mockToken';
      mutations.SET_GRAFANA_TOKEN(localState, mockToken);

      expect(localState.grafanaToken).toBe(mockToken);
    });
  });
  describe('SET_GRAFANA_ENABLED', () => {
    it('updates grafanaEnabled for integration', () => {
      mutations.SET_GRAFANA_ENABLED(localState, true);

      expect(localState.grafanaEnabled).toBe(true);
    });
  });
});