summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/store
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/store')
-rw-r--r--spec/frontend/monitoring/store/actions_spec.js44
-rw-r--r--spec/frontend/monitoring/store/getters_spec.js2
-rw-r--r--spec/frontend/monitoring/store/mutations_spec.js7
-rw-r--r--spec/frontend/monitoring/store/utils_spec.js26
4 files changed, 48 insertions, 31 deletions
diff --git a/spec/frontend/monitoring/store/actions_spec.js b/spec/frontend/monitoring/store/actions_spec.js
index 5c7ab4e6a1f..319441b5ba2 100644
--- a/spec/frontend/monitoring/store/actions_spec.js
+++ b/spec/frontend/monitoring/store/actions_spec.js
@@ -1,6 +1,6 @@
import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper';
-import { backoffMockImplementation } from 'jest/helpers/backoff_helper';
+import { backoffMockImplementation } from 'helpers/backoff_helper';
import Tracking from '~/tracking';
import axios from '~/lib/utils/axios_utils';
import statusCodes from '~/lib/utils/http_status';
@@ -88,7 +88,7 @@ describe('Monitoring store actions', () => {
// Setup
describe('setGettingStartedEmptyState', () => {
- it('should commit SET_GETTING_STARTED_EMPTY_STATE mutation', done => {
+ it('should commit SET_GETTING_STARTED_EMPTY_STATE mutation', (done) => {
testAction(
setGettingStartedEmptyState,
null,
@@ -105,7 +105,7 @@ describe('Monitoring store actions', () => {
});
describe('setInitialState', () => {
- it('should commit SET_INITIAL_STATE mutation', done => {
+ it('should commit SET_INITIAL_STATE mutation', (done) => {
testAction(
setInitialState,
{
@@ -233,7 +233,7 @@ describe('Monitoring store actions', () => {
};
});
- it('dispatches a failure', done => {
+ it('dispatches a failure', (done) => {
result()
.then(() => {
expect(commit).toHaveBeenCalledWith(
@@ -250,7 +250,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail);
});
- it('dispatches a failure action when a message is returned', done => {
+ it('dispatches a failure action when a message is returned', (done) => {
result()
.then(() => {
expect(dispatch).toHaveBeenCalledWith(
@@ -265,7 +265,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail);
});
- it('does not show a flash error when showErrorBanner is disabled', done => {
+ it('does not show a flash error when showErrorBanner is disabled', (done) => {
state.showErrorBanner = false;
result()
@@ -322,7 +322,7 @@ describe('Monitoring store actions', () => {
state.timeRange = defaultTimeRange;
});
- it('commits empty state when state.groups is empty', done => {
+ it('commits empty state when state.groups is empty', (done) => {
const localGetters = {
metricsWithData: () => [],
};
@@ -353,7 +353,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail);
});
- it('dispatches fetchPrometheusMetric for each panel query', done => {
+ it('dispatches fetchPrometheusMetric for each panel query', (done) => {
state.dashboard.panelGroups = convertObjectPropsToCamelCase(
metricsDashboardResponse.dashboard.panel_groups,
);
@@ -390,7 +390,7 @@ describe('Monitoring store actions', () => {
done();
});
- it('dispatches fetchPrometheusMetric for each panel query, handles an error', done => {
+ it('dispatches fetchPrometheusMetric for each panel query, handles an error', (done) => {
state.dashboard.panelGroups = metricsDashboardViewModel.panelGroups;
const metric = state.dashboard.panelGroups[0].panels[0].metrics[0];
@@ -449,7 +449,7 @@ describe('Monitoring store actions', () => {
};
});
- it('commits result', done => {
+ it('commits result', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction(
@@ -485,7 +485,7 @@ describe('Monitoring store actions', () => {
step: 60,
};
- it('uses calculated step', done => {
+ it('uses calculated step', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction(
@@ -527,7 +527,7 @@ describe('Monitoring store actions', () => {
step: 7,
};
- it('uses metric step', done => {
+ it('uses metric step', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction(
@@ -558,7 +558,7 @@ describe('Monitoring store actions', () => {
});
});
- it('commits failure, when waiting for results and getting a server error', done => {
+ it('commits failure, when waiting for results and getting a server error', (done) => {
mock.onGet(prometheusEndpointPath).reply(500);
const error = new Error('Request failed with status code 500');
@@ -583,7 +583,7 @@ describe('Monitoring store actions', () => {
},
],
[],
- ).catch(e => {
+ ).catch((e) => {
expect(e).toEqual(error);
done();
});
@@ -991,7 +991,7 @@ describe('Monitoring store actions', () => {
state.dashboardsEndpoint = '/dashboards.json';
});
- it('Succesful POST request resolves', done => {
+ it('Succesful POST request resolves', (done) => {
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.CREATED, {
dashboard: dashboardGitResponse[1],
});
@@ -1004,7 +1004,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail);
});
- it('Succesful POST request resolves to a dashboard', done => {
+ it('Succesful POST request resolves to a dashboard', (done) => {
const mockCreatedDashboard = dashboardGitResponse[1];
const params = {
@@ -1026,7 +1026,7 @@ describe('Monitoring store actions', () => {
});
testAction(duplicateSystemDashboard, params, state, [], [])
- .then(result => {
+ .then((result) => {
expect(mock.history.post).toHaveLength(1);
expect(mock.history.post[0].data).toEqual(expectedPayload);
expect(result).toEqual(mockCreatedDashboard);
@@ -1036,10 +1036,10 @@ describe('Monitoring store actions', () => {
.catch(done.fail);
});
- it('Failed POST request throws an error', done => {
+ it('Failed POST request throws an error', (done) => {
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST);
- testAction(duplicateSystemDashboard, {}, state, [], []).catch(err => {
+ testAction(duplicateSystemDashboard, {}, state, [], []).catch((err) => {
expect(mock.history.post).toHaveLength(1);
expect(err).toEqual(expect.any(String));
@@ -1047,14 +1047,14 @@ describe('Monitoring store actions', () => {
});
});
- it('Failed POST request throws an error with a description', done => {
+ it('Failed POST request throws an error with a description', (done) => {
const backendErrorMsg = 'This file already exists!';
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST, {
error: backendErrorMsg,
});
- testAction(duplicateSystemDashboard, {}, state, [], []).catch(err => {
+ testAction(duplicateSystemDashboard, {}, state, [], []).catch((err) => {
expect(mock.history.post).toHaveLength(1);
expect(err).toEqual(expect.any(String));
expect(err).toEqual(expect.stringContaining(backendErrorMsg));
@@ -1067,7 +1067,7 @@ describe('Monitoring store actions', () => {
// Variables manipulation
describe('updateVariablesAndFetchData', () => {
- it('should commit UPDATE_VARIABLE_VALUE mutation and fetch data', done => {
+ it('should commit UPDATE_VARIABLE_VALUE mutation and fetch data', (done) => {
testAction(
updateVariablesAndFetchData,
{ pod: 'POD' },
diff --git a/spec/frontend/monitoring/store/getters_spec.js b/spec/frontend/monitoring/store/getters_spec.js
index 509de8a4596..771ec0ea549 100644
--- a/spec/frontend/monitoring/store/getters_spec.js
+++ b/spec/frontend/monitoring/store/getters_spec.js
@@ -365,7 +365,7 @@ describe('Monitoring store Getters', () => {
describe('selectedDashboard', () => {
const { selectedDashboard } = getters;
- const localGetters = localState => ({
+ const localGetters = (localState) => ({
fullDashboardPath: getters.fullDashboardPath(localState),
});
diff --git a/spec/frontend/monitoring/store/mutations_spec.js b/spec/frontend/monitoring/store/mutations_spec.js
index 8d1351fc909..571828eb67c 100644
--- a/spec/frontend/monitoring/store/mutations_spec.js
+++ b/spec/frontend/monitoring/store/mutations_spec.js
@@ -465,7 +465,10 @@ describe('Monitoring mutations', () => {
});
expect(variable.options).toEqual({
- values: [{ text: 'prometheus', value: 'prometheus' }, { text: 'node', value: 'node' }],
+ values: [
+ { text: 'prometheus', value: 'prometheus' },
+ { text: 'node', value: 'node' },
+ ],
});
});
});
@@ -509,7 +512,7 @@ describe('Monitoring mutations', () => {
});
describe('panel preview metric', () => {
- const getPreviewMetricAt = i => stateCopy.panelPreviewGraphData.metrics[i];
+ const getPreviewMetricAt = (i) => stateCopy.panelPreviewGraphData.metrics[i];
beforeEach(() => {
stateCopy.panelPreviewGraphData = {
diff --git a/spec/frontend/monitoring/store/utils_spec.js b/spec/frontend/monitoring/store/utils_spec.js
index b97948fa1bf..58bb87cb332 100644
--- a/spec/frontend/monitoring/store/utils_spec.js
+++ b/spec/frontend/monitoring/store/utils_spec.js
@@ -127,7 +127,7 @@ describe('mapToDashboardViewModel', () => {
let dashboard;
- const setupWithPanel = panel => {
+ const setupWithPanel = (panel) => {
dashboard = {
panel_groups: [
{
@@ -340,7 +340,7 @@ describe('mapToDashboardViewModel', () => {
],
});
- const getMappedMetric = dashboard => {
+ const getMappedMetric = (dashboard) => {
return mapToDashboardViewModel(dashboard).panelGroups[0].panels[0].metrics[0];
};
@@ -775,7 +775,11 @@ describe('normalizeQueryResponseData', () => {
job: 'prometheus',
instance: 'localhost:9090',
},
- values: [[1435781430.781, '1'], [1435781445.781, '2'], [1435781460.781, '3']],
+ values: [
+ [1435781430.781, '1'],
+ [1435781445.781, '2'],
+ [1435781460.781, '3'],
+ ],
},
{
metric: {
@@ -783,7 +787,11 @@ describe('normalizeQueryResponseData', () => {
job: 'node',
instance: 'localhost:9091',
},
- values: [[1435781430.781, '4'], [1435781445.781, '5'], [1435781460.781, '6']],
+ values: [
+ [1435781430.781, '4'],
+ [1435781445.781, '5'],
+ [1435781460.781, '6'],
+ ],
},
],
};
@@ -840,7 +848,10 @@ describe('normalizeQueryResponseData', () => {
job: 'prometheus',
instance: 'localhost:9090',
},
- values: [[1435781430.781, '1'], [1435781460.781, 'NaN']],
+ values: [
+ [1435781430.781, '1'],
+ [1435781460.781, 'NaN'],
+ ],
},
],
};
@@ -849,7 +860,10 @@ describe('normalizeQueryResponseData', () => {
{
metric: { __name__: 'up', instance: 'localhost:9090', job: 'prometheus' },
value: ['2015-07-01T20:11:00.781Z', NaN],
- values: [['2015-07-01T20:10:30.781Z', 1], ['2015-07-01T20:11:00.781Z', NaN]],
+ values: [
+ ['2015-07-01T20:10:30.781Z', 1],
+ ['2015-07-01T20:11:00.781Z', NaN],
+ ],
},
]);
});