diff options
Diffstat (limited to 'spec/frontend/jobs/store/actions_spec.js')
-rw-r--r-- | spec/frontend/jobs/store/actions_spec.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/frontend/jobs/store/actions_spec.js b/spec/frontend/jobs/store/actions_spec.js index 0d11c4d56bf..73a158d52d8 100644 --- a/spec/frontend/jobs/store/actions_spec.js +++ b/spec/frontend/jobs/store/actions_spec.js @@ -30,6 +30,7 @@ import { import * as types from '~/jobs/store/mutation_types'; import state from '~/jobs/store/state'; import axios from '~/lib/utils/axios_utils'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; describe('Job State actions', () => { let mockedState; @@ -112,7 +113,9 @@ describe('Job State actions', () => { describe('success', () => { it('dispatches requestJob and receiveJobSuccess', () => { - mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 121212, name: 'karma' }); + mock + .onGet(`${TEST_HOST}/endpoint.json`) + .replyOnce(HTTP_STATUS_OK, { id: 121212, name: 'karma' }); return testAction( fetchJob, @@ -134,7 +137,7 @@ describe('Job State actions', () => { describe('error', () => { beforeEach(() => { - mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); + mock.onGet(`${TEST_HOST}/endpoint.json`).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); }); it('dispatches requestJob and receiveJobError', () => { @@ -214,7 +217,7 @@ describe('Job State actions', () => { describe('success', () => { it('dispatches requestJobLog, receiveJobLogSuccess and stopPollingJobLog when job is complete', () => { - mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, { + mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(HTTP_STATUS_OK, { html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :', complete: true, }); @@ -252,7 +255,7 @@ describe('Job State actions', () => { complete: false, }; - mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, jobLogPayload); + mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(HTTP_STATUS_OK, jobLogPayload); }); it('dispatches startPollingJobLog', () => { @@ -288,7 +291,7 @@ describe('Job State actions', () => { describe('error', () => { beforeEach(() => { - mock.onGet(`${TEST_HOST}/endpoint/trace.json`).reply(500); + mock.onGet(`${TEST_HOST}/endpoint/trace.json`).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); }); it('dispatches requestJobLog and receiveJobLogError', () => { @@ -424,9 +427,10 @@ describe('Job State actions', () => { describe('success', () => { it('dispatches requestJobsForStage and receiveJobsForStageSuccess', () => { - mock - .onGet(`${TEST_HOST}/jobs.json`) - .replyOnce(200, { latest_statuses: [{ id: 121212, name: 'build' }], retried: [] }); + mock.onGet(`${TEST_HOST}/jobs.json`).replyOnce(HTTP_STATUS_OK, { + latest_statuses: [{ id: 121212, name: 'build' }], + retried: [], + }); return testAction( fetchJobsForStage, @@ -449,7 +453,7 @@ describe('Job State actions', () => { describe('error', () => { beforeEach(() => { - mock.onGet(`${TEST_HOST}/jobs.json`).reply(500); + mock.onGet(`${TEST_HOST}/jobs.json`).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); }); it('dispatches requestJobsForStage and receiveJobsForStageError', () => { |