Commit 3aee8089 authored by Miguel Rincon's avatar Miguel Rincon

Remove repeating dispatch and commit mocks

parent d9a1e681
......@@ -62,11 +62,17 @@ describe('Monitoring store actions', () => {
let store;
let state;
let dispatch;
let commit;
beforeEach(() => {
store = createStore({ getters });
state = store.state.monitoringDashboard;
mock = new MockAdapter(axios);
commit = jest.fn();
dispatch = jest.fn();
jest.spyOn(commonUtils, 'backOff').mockImplementation(callback => {
const q = new Promise((resolve, reject) => {
const stop = arg => (arg instanceof Error ? reject(arg) : resolve(arg));
......@@ -199,12 +205,8 @@ describe('Monitoring store actions', () => {
// Metrics dashboard
describe('fetchDashboard', () => {
let dispatch;
let commit;
const response = metricsDashboardResponse;
beforeEach(() => {
dispatch = jest.fn();
commit = jest.fn();
state.dashboardEndpoint = '/dashboard';
});
......@@ -291,14 +293,6 @@ describe('Monitoring store actions', () => {
});
describe('receiveMetricsDashboardSuccess', () => {
let commit;
let dispatch;
beforeEach(() => {
commit = jest.fn();
dispatch = jest.fn();
});
it('stores groups', () => {
const response = metricsDashboardResponse;
receiveMetricsDashboardSuccess({ state, commit, dispatch }, { response });
......@@ -358,13 +352,8 @@ describe('Monitoring store actions', () => {
// Metrics
describe('fetchDashboardData', () => {
let commit;
let dispatch;
beforeEach(() => {
jest.spyOn(Tracking, 'event');
commit = jest.fn();
dispatch = jest.fn();
state.timeRange = defaultTimeRange;
});
......
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