debian-mirror-gitlab/spec/frontend/grafana_integration/store/mutations_spec.js

36 lines
946 B
JavaScript
Raw Normal View History

2019-12-26 22:10:19 +05:30
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);
});
});
});