diff options
Diffstat (limited to 'spec/frontend/feature_flags/store/index/actions_spec.js')
-rw-r--r-- | spec/frontend/feature_flags/store/index/actions_spec.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/frontend/feature_flags/store/index/actions_spec.js b/spec/frontend/feature_flags/store/index/actions_spec.js index 96a7d868316..46a7843b937 100644 --- a/spec/frontend/feature_flags/store/index/actions_spec.js +++ b/spec/frontend/feature_flags/store/index/actions_spec.js @@ -20,6 +20,7 @@ import { import * as types from '~/feature_flags/store/index/mutation_types'; import state from '~/feature_flags/store/index/state'; import axios from '~/lib/utils/axios_utils'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { getRequestData, rotateData, featureFlag } from '../../mock_data'; jest.mock('~/api.js'); @@ -57,7 +58,7 @@ describe('Feature flags actions', () => { describe('success', () => { it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess', () => { - mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {}); + mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(HTTP_STATUS_OK, getRequestData, {}); return testAction( fetchFeatureFlags, @@ -79,7 +80,9 @@ describe('Feature flags actions', () => { describe('error', () => { it('dispatches requestFeatureFlags and receiveFeatureFlagsError', () => { - mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); + mock + .onGet(`${TEST_HOST}/endpoint.json`, {}) + .replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, {}); return testAction( fetchFeatureFlags, @@ -154,7 +157,7 @@ describe('Feature flags actions', () => { describe('success', () => { it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess', () => { - mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {}); + mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(HTTP_STATUS_OK, rotateData, {}); return testAction( rotateInstanceId, @@ -176,7 +179,9 @@ describe('Feature flags actions', () => { describe('error', () => { it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError', () => { - mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); + mock + .onGet(`${TEST_HOST}/endpoint.json`, {}) + .replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, {}); return testAction( rotateInstanceId, @@ -252,7 +257,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', () => { - mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {}); + mock.onPut(featureFlag.update_path).replyOnce(HTTP_STATUS_OK, featureFlag, {}); return testAction( toggleFeatureFlag, @@ -275,7 +280,7 @@ describe('Feature flags actions', () => { describe('error', () => { it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', () => { - mock.onPut(featureFlag.update_path).replyOnce(500); + mock.onPut(featureFlag.update_path).replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR); return testAction( toggleFeatureFlag, |