diff options
Diffstat (limited to 'spec/frontend/feature_flags/components/feature_flags_spec.js')
-rw-r--r-- | spec/frontend/feature_flags/components/feature_flags_spec.js | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/spec/frontend/feature_flags/components/feature_flags_spec.js b/spec/frontend/feature_flags/components/feature_flags_spec.js index d27b23c5cd1..e80f9c559c4 100644 --- a/spec/frontend/feature_flags/components/feature_flags_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_spec.js @@ -11,6 +11,7 @@ import FeatureFlagsComponent from '~/feature_flags/components/feature_flags.vue' import FeatureFlagsTable from '~/feature_flags/components/feature_flags_table.vue'; import createStore from '~/feature_flags/store/index'; import axios from '~/lib/utils/axios_utils'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue'; import { getRequestData } from '../mock_data'; @@ -74,7 +75,7 @@ describe('Feature flags', () => { beforeEach(() => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { page: '1' } }) - .reply(200, getRequestData, {}); + .reply(HTTP_STATUS_OK, getRequestData, {}); factory(provideData); return waitForPromises(); }); @@ -119,7 +120,7 @@ describe('Feature flags', () => { beforeEach(() => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { page: '1' } }) - .reply(200, getRequestData, {}); + .reply(HTTP_STATUS_OK, getRequestData, {}); factory(provideData); return waitForPromises(); }); @@ -141,7 +142,7 @@ describe('Feature flags', () => { it('renders a loading icon', () => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { page: '1' } }) - .replyOnce(200, getRequestData, {}); + .replyOnce(HTTP_STATUS_OK, getRequestData, {}); factory(); @@ -158,7 +159,7 @@ describe('Feature flags', () => { beforeEach(async () => { mock.onGet(mockState.endpoint, { params: { page: '1' } }).reply( - 200, + HTTP_STATUS_OK, { feature_flags: [], count: { @@ -203,14 +204,16 @@ describe('Feature flags', () => { describe('with paginated feature flags', () => { beforeEach(() => { - mock.onGet(mockState.endpoint, { params: { page: '1' } }).replyOnce(200, getRequestData, { - 'x-next-page': '2', - 'x-page': '1', - 'X-Per-Page': '2', - 'X-Prev-Page': '', - 'X-TOTAL': '37', - 'X-Total-Pages': '5', - }); + mock + .onGet(mockState.endpoint, { params: { page: '1' } }) + .replyOnce(HTTP_STATUS_OK, getRequestData, { + 'x-next-page': '2', + 'x-page': '1', + 'X-Per-Page': '2', + 'X-Prev-Page': '', + 'X-TOTAL': '37', + 'X-Total-Pages': '5', + }); factory(); jest.spyOn(store, 'dispatch'); @@ -271,7 +274,9 @@ describe('Feature flags', () => { describe('unsuccessful request', () => { beforeEach(() => { - mock.onGet(mockState.endpoint, { params: { page: '1' } }).replyOnce(500, {}); + mock + .onGet(mockState.endpoint, { params: { page: '1' } }) + .replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, {}); factory(); return waitForPromises(); @@ -303,7 +308,7 @@ describe('Feature flags', () => { beforeEach(() => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { page: '1' } }) - .reply(200, getRequestData, {}); + .reply(HTTP_STATUS_OK, getRequestData, {}); factory(); return waitForPromises(); }); |