diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-27 00:11:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-27 00:11:52 +0300 |
commit | e04b8c1e60649802ae4249dae7fa7aaf3f0a83c7 (patch) | |
tree | dc5607b353067e079443b9478572e4a394bfe011 /spec/frontend/ide | |
parent | cea01cb81787f0d2c119b287a5833f2e267324bc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ide')
6 files changed, 28 insertions, 19 deletions
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 38a54e569a9..90ca8526698 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -7,6 +7,7 @@ import { createStore } from '~/ide/stores'; import * as actions from '~/ide/stores/actions/file'; import * as types from '~/ide/stores/mutation_types'; import axios from '~/lib/utils/axios_utils'; +import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { stubPerformanceWebAPI } from 'helpers/performance'; import { file, createTriggerRenameAction, createTriggerUpdatePayload } from '../../helpers'; @@ -243,7 +244,7 @@ describe('IDE store file actions', () => { describe('success', () => { beforeEach(() => { mock.onGet(`${RELATIVE_URL_ROOT}/test/test/-/7297abc/${localFile.path}`).replyOnce( - 200, + HTTP_STATUS_OK, { raw_path: 'raw_path', }, @@ -320,7 +321,7 @@ describe('IDE store file actions', () => { store.state.entries[localFile.path] = localFile; mock.onGet(`${RELATIVE_URL_ROOT}/test/test/-/7297abc/old-dull-file`).replyOnce( - 200, + HTTP_STATUS_OK, { raw_path: 'raw_path', }, @@ -377,7 +378,7 @@ describe('IDE store file actions', () => { describe('success', () => { beforeEach(() => { - mock.onGet(/(.*)/).replyOnce(200, 'raw'); + mock.onGet(/(.*)/).replyOnce(HTTP_STATUS_OK, 'raw'); }); it('calls getRawFileData service method', () => { @@ -470,7 +471,7 @@ describe('IDE store file actions', () => { describe('return JSON', () => { beforeEach(() => { - mock.onGet(/(.*)/).replyOnce(200, JSON.stringify({ test: '123' })); + mock.onGet(/(.*)/).replyOnce(HTTP_STATUS_OK, JSON.stringify({ test: '123' })); }); it('does not parse returned JSON', () => { diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js index 4551a7a21f1..47b6ebb3376 100644 --- a/spec/frontend/ide/stores/actions/tree_spec.js +++ b/spec/frontend/ide/stores/actions/tree_spec.js @@ -8,7 +8,7 @@ import { createStore } from '~/ide/stores'; import { showTreeEntry, getFiles, setDirectoryData } from '~/ide/stores/actions/tree'; import * as types from '~/ide/stores/mutation_types'; import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { file, createEntriesFromPaths } from '../../helpers'; describe('Multi-file store tree actions', () => { @@ -53,7 +53,7 @@ describe('Multi-file store tree actions', () => { mock .onGet(/(.*)/) - .replyOnce(200, [ + .replyOnce(HTTP_STATUS_OK, [ 'file.txt', 'folder/fileinfolder.js', 'folder/subfolder/fileinsubfolder.js', diff --git a/spec/frontend/ide/stores/modules/branches/actions_spec.js b/spec/frontend/ide/stores/modules/branches/actions_spec.js index 38a2e1ac12f..c1c47ef7e9a 100644 --- a/spec/frontend/ide/stores/modules/branches/actions_spec.js +++ b/spec/frontend/ide/stores/modules/branches/actions_spec.js @@ -10,7 +10,7 @@ import { import * as types from '~/ide/stores/modules/branches/mutation_types'; import state from '~/ide/stores/modules/branches/state'; import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { branches, projectData } from '../../../mock_data'; describe('IDE branches actions', () => { @@ -95,7 +95,9 @@ describe('IDE branches actions', () => { describe('success', () => { beforeEach(() => { - mock.onGet(/\/api\/v4\/projects\/\d+\/repository\/branches(.*)$/).replyOnce(200, branches); + mock + .onGet(/\/api\/v4\/projects\/\d+\/repository\/branches(.*)$/) + .replyOnce(HTTP_STATUS_OK, branches); }); it('calls API with params', () => { diff --git a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js index 0a99496a147..a5ce507bd3c 100644 --- a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js +++ b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js @@ -4,7 +4,7 @@ import * as actions from '~/ide/stores/modules/file_templates/actions'; import * as types from '~/ide/stores/modules/file_templates/mutation_types'; import createState from '~/ide/stores/modules/file_templates/state'; import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; describe('IDE file templates actions', () => { let state; @@ -75,7 +75,7 @@ describe('IDE file templates actions', () => { const page = pages[pageNum - 1]; const hasNextPage = pageNum < pages.length; - return [200, page, hasNextPage ? { 'X-NEXT-PAGE': pageNum + 1 } : {}]; + return [HTTP_STATUS_OK, page, hasNextPage ? { 'X-NEXT-PAGE': pageNum + 1 } : {}]; }); }); @@ -200,10 +200,10 @@ describe('IDE file templates actions', () => { beforeEach(() => { mock .onGet(/api\/(.*)\/templates\/licenses\/mit/) - .replyOnce(200, { content: 'MIT content' }); + .replyOnce(HTTP_STATUS_OK, { content: 'MIT content' }); mock .onGet(/api\/(.*)\/templates\/licenses\/testing/) - .replyOnce(200, { content: 'testing content' }); + .replyOnce(HTTP_STATUS_OK, { content: 'testing content' }); }); it('dispatches setFileTemplate if template already has content', () => { diff --git a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js index 5d3bf063ac8..56901383f7b 100644 --- a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js +++ b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js @@ -10,7 +10,7 @@ import { import * as types from '~/ide/stores/modules/merge_requests/mutation_types'; import state from '~/ide/stores/modules/merge_requests/state'; import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status'; +import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { mergeRequests } from '../../../mock_data'; describe('IDE merge requests actions', () => { @@ -81,7 +81,7 @@ describe('IDE merge requests actions', () => { describe('success', () => { beforeEach(() => { - mock.onGet(/\/api\/v4\/merge_requests\/?/).replyOnce(200, mergeRequests); + mock.onGet(/\/api\/v4\/merge_requests\/?/).replyOnce(HTTP_STATUS_OK, mergeRequests); }); it('calls API with params', () => { @@ -133,7 +133,9 @@ describe('IDE merge requests actions', () => { describe('success without type', () => { beforeEach(() => { - mock.onGet(/\/api\/v4\/projects\/.+\/merge_requests\/?$/).replyOnce(200, mergeRequests); + mock + .onGet(/\/api\/v4\/projects\/.+\/merge_requests\/?$/) + .replyOnce(HTTP_STATUS_OK, mergeRequests); }); it('calls API with project', () => { diff --git a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js index 00403809504..f49ff75ba7e 100644 --- a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js +++ b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js @@ -25,7 +25,11 @@ import { import * as types from '~/ide/stores/modules/pipelines/mutation_types'; import state from '~/ide/stores/modules/pipelines/state'; import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_NOT_FOUND } from '~/lib/utils/http_status'; +import { + HTTP_STATUS_INTERNAL_SERVER_ERROR, + HTTP_STATUS_NOT_FOUND, + HTTP_STATUS_OK, +} from '~/lib/utils/http_status'; import waitForPromises from 'helpers/wait_for_promises'; import { pipelines, jobs } from '../../../mock_data'; @@ -119,7 +123,7 @@ describe('IDE pipelines actions', () => { beforeEach(() => { mock .onGet('/abc/def/commit/abc123def456ghi789jkl/pipelines') - .reply(200, { data: { foo: 'bar' } }, { 'poll-interval': '10000' }); + .reply(HTTP_STATUS_OK, { data: { foo: 'bar' } }, { 'poll-interval': '10000' }); }); it('dispatches request', async () => { @@ -241,7 +245,7 @@ describe('IDE pipelines actions', () => { describe('success', () => { beforeEach(() => { - mock.onGet(stage.dropdownPath).replyOnce(200, jobs); + mock.onGet(stage.dropdownPath).replyOnce(HTTP_STATUS_OK, jobs); }); it('dispatches request', () => { @@ -370,7 +374,7 @@ describe('IDE pipelines actions', () => { describe('success', () => { beforeEach(() => { jest.spyOn(axios, 'get'); - mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(200, { html: 'html' }); + mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(HTTP_STATUS_OK, { html: 'html' }); }); it('dispatches request', () => { |