Commit a055c03a authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'mrincon-refactor-repeating-mocks-actions' into 'master'

Remove repeating dispatch and commit mocks

See merge request gitlab-org/gitlab!35203
parents 7e801552 3aee8089
......@@ -63,11 +63,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));
......@@ -200,12 +206,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';
});
......@@ -292,14 +294,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 });
......@@ -359,13 +353,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