summaryrefslogtreecommitdiff
path: root/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/analytics/cycle_analytics/store/actions_spec.js')
-rw-r--r--spec/frontend/analytics/cycle_analytics/store/actions_spec.js38
1 files changed, 18 insertions, 20 deletions
diff --git a/spec/frontend/analytics/cycle_analytics/store/actions_spec.js b/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
index f87807804c9..3030fca126b 100644
--- a/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
+++ b/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper';
import * as actions from '~/analytics/cycle_analytics/store/actions';
import * as getters from '~/analytics/cycle_analytics/store/getters';
-import httpStatusCodes from '~/lib/utils/http_status';
+import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_OK } from '~/lib/utils/http_status';
import {
allowedStages,
selectedStage,
@@ -197,7 +197,7 @@ describe('Project Value Stream Analytics actions', () => {
selectedStage,
};
mock = new MockAdapter(axios);
- mock.onGet(mockStagePath).reply(httpStatusCodes.OK, reviewEvents, headers);
+ mock.onGet(mockStagePath).reply(HTTP_STATUS_OK, reviewEvents, headers);
});
it(`commits the 'RECEIVE_STAGE_DATA_SUCCESS' mutation`, () =>
@@ -223,7 +223,7 @@ describe('Project Value Stream Analytics actions', () => {
selectedStage,
};
mock = new MockAdapter(axios);
- mock.onGet(mockStagePath).reply(httpStatusCodes.OK, { error: tooMuchDataError });
+ mock.onGet(mockStagePath).reply(HTTP_STATUS_OK, { error: tooMuchDataError });
});
it(`commits the 'RECEIVE_STAGE_DATA_ERROR' mutation`, () =>
@@ -247,7 +247,7 @@ describe('Project Value Stream Analytics actions', () => {
selectedStage,
};
mock = new MockAdapter(axios);
- mock.onGet(mockStagePath).reply(httpStatusCodes.BAD_REQUEST);
+ mock.onGet(mockStagePath).reply(HTTP_STATUS_BAD_REQUEST);
});
it(`commits the 'RECEIVE_STAGE_DATA_ERROR' mutation`, () =>
@@ -269,7 +269,7 @@ describe('Project Value Stream Analytics actions', () => {
endpoints: mockEndpoints,
};
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.OK);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_OK);
});
it(`commits the 'REQUEST_VALUE_STREAMS' mutation`, () =>
@@ -284,7 +284,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('with a failing request', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.BAD_REQUEST);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_BAD_REQUEST);
});
it(`commits the 'RECEIVE_VALUE_STREAMS_ERROR' mutation`, () =>
@@ -294,7 +294,7 @@ describe('Project Value Stream Analytics actions', () => {
payload: {},
expectedMutations: [
{ type: 'REQUEST_VALUE_STREAMS' },
- { type: 'RECEIVE_VALUE_STREAMS_ERROR', payload: httpStatusCodes.BAD_REQUEST },
+ { type: 'RECEIVE_VALUE_STREAMS_ERROR', payload: HTTP_STATUS_BAD_REQUEST },
],
expectedActions: [],
}));
@@ -337,7 +337,7 @@ describe('Project Value Stream Analytics actions', () => {
selectedValueStream,
};
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.OK);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_OK);
});
it(`commits the 'REQUEST_VALUE_STREAM_STAGES' and 'RECEIVE_VALUE_STREAM_STAGES_SUCCESS' mutations`, () =>
@@ -355,7 +355,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('with a failing request', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.BAD_REQUEST);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_BAD_REQUEST);
});
it(`commits the 'RECEIVE_VALUE_STREAM_STAGES_ERROR' mutation`, () =>
@@ -365,7 +365,7 @@ describe('Project Value Stream Analytics actions', () => {
payload: {},
expectedMutations: [
{ type: 'REQUEST_VALUE_STREAM_STAGES' },
- { type: 'RECEIVE_VALUE_STREAM_STAGES_ERROR', payload: httpStatusCodes.BAD_REQUEST },
+ { type: 'RECEIVE_VALUE_STREAM_STAGES_ERROR', payload: HTTP_STATUS_BAD_REQUEST },
],
expectedActions: [],
}));
@@ -382,7 +382,7 @@ describe('Project Value Stream Analytics actions', () => {
];
const stageMedianError = new Error(
- `Request failed with status code ${httpStatusCodes.BAD_REQUEST}`,
+ `Request failed with status code ${HTTP_STATUS_BAD_REQUEST}`,
);
beforeEach(() => {
@@ -392,7 +392,7 @@ describe('Project Value Stream Analytics actions', () => {
stages: allowedStages,
};
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.OK);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_OK);
});
it(`commits the 'REQUEST_STAGE_MEDIANS' and 'RECEIVE_STAGE_MEDIANS_SUCCESS' mutations`, () =>
@@ -410,7 +410,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('with a failing request', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.BAD_REQUEST);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_BAD_REQUEST);
});
it(`commits the 'RECEIVE_VALUE_STREAM_STAGES_ERROR' mutation`, () =>
@@ -435,9 +435,7 @@ describe('Project Value Stream Analytics actions', () => {
{ id: 'code', count: 3 },
];
- const stageCountError = new Error(
- `Request failed with status code ${httpStatusCodes.BAD_REQUEST}`,
- );
+ const stageCountError = new Error(`Request failed with status code ${HTTP_STATUS_BAD_REQUEST}`);
beforeEach(() => {
state = {
@@ -448,11 +446,11 @@ describe('Project Value Stream Analytics actions', () => {
mock = new MockAdapter(axios);
mock
.onGet(mockValueStreamPath)
- .replyOnce(httpStatusCodes.OK, { count: 1 })
+ .replyOnce(HTTP_STATUS_OK, { count: 1 })
.onGet(mockValueStreamPath)
- .replyOnce(httpStatusCodes.OK, { count: 2 })
+ .replyOnce(HTTP_STATUS_OK, { count: 2 })
.onGet(mockValueStreamPath)
- .replyOnce(httpStatusCodes.OK, { count: 3 });
+ .replyOnce(HTTP_STATUS_OK, { count: 3 });
});
it(`commits the 'REQUEST_STAGE_COUNTS' and 'RECEIVE_STAGE_COUNTS_SUCCESS' mutations`, () =>
@@ -470,7 +468,7 @@ describe('Project Value Stream Analytics actions', () => {
describe('with a failing request', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
- mock.onGet(mockValueStreamPath).reply(httpStatusCodes.BAD_REQUEST);
+ mock.onGet(mockValueStreamPath).reply(HTTP_STATUS_BAD_REQUEST);
});
it(`commits the 'RECEIVE_STAGE_COUNTS_ERROR' mutation`, () =>