diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/frontend/ide | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/frontend/ide')
35 files changed, 202 insertions, 196 deletions
diff --git a/spec/frontend/ide/components/branches/item_spec.js b/spec/frontend/ide/components/branches/item_spec.js index f90c298c401..271d0600e16 100644 --- a/spec/frontend/ide/components/branches/item_spec.js +++ b/spec/frontend/ide/components/branches/item_spec.js @@ -7,7 +7,7 @@ import Timeago from '~/vue_shared/components/time_ago_tooltip.vue'; import { projectData } from '../../mock_data'; const TEST_BRANCH = { - name: 'master', + name: 'main', committedDate: '2018-01-05T05:50Z', }; const TEST_PROJECT_ID = projectData.name_with_namespace; diff --git a/spec/frontend/ide/components/commit_sidebar/actions_spec.js b/spec/frontend/ide/components/commit_sidebar/actions_spec.js index c4dccf26af3..ed9d11246ae 100644 --- a/spec/frontend/ide/components/commit_sidebar/actions_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/actions_spec.js @@ -10,7 +10,7 @@ import { const ACTION_UPDATE_COMMIT_ACTION = 'commit/updateCommitAction'; -const BRANCH_DEFAULT = 'master'; +const BRANCH_DEFAULT = 'main'; const BRANCH_PROTECTED = 'protected/access'; const BRANCH_PROTECTED_NO_ACCESS = 'protected/no-access'; const BRANCH_REGULAR = 'regular'; @@ -20,11 +20,7 @@ describe('IDE commit sidebar actions', () => { let store; let vm; - const createComponent = ({ - hasMR = false, - currentBranchId = 'master', - emptyRepo = false, - } = {}) => { + const createComponent = ({ hasMR = false, currentBranchId = 'main', emptyRepo = false } = {}) => { const Component = Vue.extend(commitActions); vm = createComponentWithStore(Component, store); @@ -72,7 +68,7 @@ describe('IDE commit sidebar actions', () => { it('renders current branch text', () => { createComponent(); - expect(findText()).toContain('Commit to master branch'); + expect(findText()).toContain('Commit to main branch'); }); it('hides merge request option when project merge requests are disabled', (done) => { @@ -112,7 +108,7 @@ describe('IDE commit sidebar actions', () => { it('calls again after staged changes', (done) => { createComponent({ currentBranchId: null }); - vm.$store.state.currentBranchId = 'master'; + vm.$store.state.currentBranchId = 'main'; vm.$store.state.changedFiles.push({}); vm.$store.state.stagedFiles.push({}); @@ -158,7 +154,7 @@ describe('IDE commit sidebar actions', () => { it('only renders commit to current branch', () => { expect(findRadios().length).toBe(1); - expect(findText()).toContain('Commit to master branch'); + expect(findText()).toContain('Commit to main branch'); }); }); }); diff --git a/spec/frontend/ide/components/commit_sidebar/form_spec.js b/spec/frontend/ide/components/commit_sidebar/form_spec.js index f5916b021aa..83d1bbb842e 100644 --- a/spec/frontend/ide/components/commit_sidebar/form_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/form_spec.js @@ -67,7 +67,7 @@ describe('IDE commit form', () => { store = createStore(); store.state.stagedFiles.push('test'); store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; Vue.set(store.state.projects, 'abcproject', { ...projectData, userPermissions: { pushCode: true }, diff --git a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js index 253c2a426ee..4474647552d 100644 --- a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js @@ -24,7 +24,7 @@ describe('create new MR checkbox', () => { store.state.projects[store.state.currentProjectId].userPermissions = permissions; }; - const createComponent = ({ currentBranchId = 'master', createNewBranch = false } = {}) => { + const createComponent = ({ currentBranchId = 'main', createNewBranch = false } = {}) => { const Component = Vue.extend(NewMergeRequestOption); vm = createComponentWithStore(Component, store); @@ -63,7 +63,7 @@ describe('create new MR checkbox', () => { describe('is rendered when pushing to a new branch', () => { beforeEach(() => { createComponent({ - currentBranchId: 'master', + currentBranchId: 'main', createNewBranch: true, }); }); @@ -87,7 +87,7 @@ describe('create new MR checkbox', () => { describe('is NOT rendered when pushing to the same branch', () => { beforeEach(() => { createComponent({ - currentBranchId: 'master', + currentBranchId: 'main', createNewBranch: false, }); }); diff --git a/spec/frontend/ide/components/ide_review_spec.js b/spec/frontend/ide/components/ide_review_spec.js index 740b7ada521..7a92f59641f 100644 --- a/spec/frontend/ide/components/ide_review_spec.js +++ b/spec/frontend/ide/components/ide_review_spec.js @@ -19,9 +19,9 @@ describe('IDE review mode', () => { beforeEach(() => { store = createStore(); store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = { ...projectData }; - Vue.set(store.state.trees, 'abcproject/master', { + Vue.set(store.state.trees, 'abcproject/main', { tree: [file('fileName')], loading: false, }); diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js index b23a78a035d..f8d29fc7b47 100644 --- a/spec/frontend/ide/components/ide_spec.js +++ b/spec/frontend/ide/components/ide_spec.js @@ -22,9 +22,9 @@ describe('WebIDE', () => { const createComponent = ({ projData = emptyProjData, state = {} } = {}) => { store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = projData && { ...projData }; - store.state.trees['abcproject/master'] = { + store.state.trees['abcproject/main'] = { tree: [], loading: false, }; diff --git a/spec/frontend/ide/components/ide_status_bar_spec.js b/spec/frontend/ide/components/ide_status_bar_spec.js index 9d33a1e2554..f1a0b64caf2 100644 --- a/spec/frontend/ide/components/ide_status_bar_spec.js +++ b/spec/frontend/ide/components/ide_status_bar_spec.js @@ -24,7 +24,7 @@ describe('ideStatusBar', () => { store = createStore(); store.state.currentProjectId = TEST_PROJECT_ID; store.state.projects[TEST_PROJECT_ID] = _.clone(projectData); - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; }); afterEach(() => { diff --git a/spec/frontend/ide/components/ide_tree_list_spec.js b/spec/frontend/ide/components/ide_tree_list_spec.js index c8153ea339e..85d9feb0c09 100644 --- a/spec/frontend/ide/components/ide_tree_list_spec.js +++ b/spec/frontend/ide/components/ide_tree_list_spec.js @@ -14,9 +14,9 @@ describe('IDE tree list', () => { const bootstrapWithTree = (tree = normalBranchTree) => { store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = { ...projectData }; - Vue.set(store.state.trees, 'abcproject/master', { + Vue.set(store.state.trees, 'abcproject/main', { tree, loading: false, }); @@ -42,7 +42,7 @@ describe('IDE tree list', () => { }); it('renders loading indicator', (done) => { - store.state.trees['abcproject/master'].loading = true; + store.state.trees['abcproject/main'].loading = true; vm.$nextTick(() => { expect(vm.$el.querySelector('.multi-file-loading-container')).not.toBeNull(); diff --git a/spec/frontend/ide/components/ide_tree_spec.js b/spec/frontend/ide/components/ide_tree_spec.js index 6eef646b012..0792b88aeb6 100644 --- a/spec/frontend/ide/components/ide_tree_spec.js +++ b/spec/frontend/ide/components/ide_tree_spec.js @@ -18,9 +18,9 @@ describe('IdeTree', () => { store = createStore(); store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = { ...projectData }; - Vue.set(store.state.trees, 'abcproject/master', { + Vue.set(store.state.trees, 'abcproject/main', { tree: [file('fileName')], loading: false, }); diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js index 85acabca38b..610e20d5868 100644 --- a/spec/frontend/ide/components/merge_requests/list_spec.js +++ b/spec/frontend/ide/components/merge_requests/list_spec.js @@ -21,7 +21,7 @@ describe('IDE merge requests list', () => { const fakeStore = new Vuex.Store({ state: { currentMergeRequestId: '1', - currentProjectId: 'project/master', + currentProjectId: 'project/main', ...restOfState, }, modules: { diff --git a/spec/frontend/ide/components/nav_dropdown_spec.js b/spec/frontend/ide/components/nav_dropdown_spec.js index 4ddb3930764..6a1be7ee964 100644 --- a/spec/frontend/ide/components/nav_dropdown_spec.js +++ b/spec/frontend/ide/components/nav_dropdown_spec.js @@ -14,14 +14,14 @@ describe('IDE NavDropdown', () => { store = createStore(); Object.assign(store.state, { currentProjectId: TEST_PROJECT_ID, - currentBranchId: 'master', + currentBranchId: 'main', projects: { [TEST_PROJECT_ID]: { userPermissions: { [PERMISSION_READ_MR]: true, }, branches: { - master: { id: 'master' }, + main: { id: 'main' }, }, }, }, diff --git a/spec/frontend/ide/components/new_dropdown/index_spec.js b/spec/frontend/ide/components/new_dropdown/index_spec.js index 5a1c0471206..fa34d1b257f 100644 --- a/spec/frontend/ide/components/new_dropdown/index_spec.js +++ b/spec/frontend/ide/components/new_dropdown/index_spec.js @@ -13,7 +13,7 @@ describe('new dropdown component', () => { const component = Vue.extend(newDropdown); vm = createComponentWithStore(component, store, { - branch: 'master', + branch: 'main', path: '', mouseOver: false, type: 'tree', diff --git a/spec/frontend/ide/components/new_dropdown/modal_spec.js b/spec/frontend/ide/components/new_dropdown/modal_spec.js index 0600fcea917..fce6ccf4b58 100644 --- a/spec/frontend/ide/components/new_dropdown/modal_spec.js +++ b/spec/frontend/ide/components/new_dropdown/modal_spec.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import createFlash from '~/flash'; import modal from '~/ide/components/new_dropdown/modal.vue'; import { createStore } from '~/ide/stores'; @@ -182,14 +182,14 @@ describe('new file modal component', () => { vm.submitForm(); - expect(createFlash).toHaveBeenCalledWith( - 'The name "test-path/test" is already taken in this directory.', - 'alert', - expect.anything(), - null, - false, - true, - ); + expect(createFlash).toHaveBeenCalledWith({ + message: 'The name "test-path/test" is already taken in this directory.', + type: 'alert', + parent: expect.anything(), + actionConfig: null, + fadeTransition: false, + addBodyClass: true, + }); }); it('does not throw error when target entry does not exist', () => { diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js index c174f5e2006..db4181395d3 100644 --- a/spec/frontend/ide/components/repo_commit_section_spec.js +++ b/spec/frontend/ide/components/repo_commit_section_spec.js @@ -22,11 +22,11 @@ describe('RepoCommitSection', () => { store.state.noChangesStateSvgPath = 'svg'; store.state.committedStateSvgPath = 'commitsvg'; store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = { web_url: '', branches: { - master: { + main: { workingReference: '1', }, }, @@ -39,7 +39,7 @@ describe('RepoCommitSection', () => { }), ); - store.state.currentBranch = 'master'; + store.state.currentBranch = 'main'; store.state.changedFiles = []; store.state.stagedFiles = [{ ...files[0] }, { ...files[1] }]; store.state.stagedFiles.forEach((f) => diff --git a/spec/frontend/ide/components/repo_editor_spec.js b/spec/frontend/ide/components/repo_editor_spec.js index 646e51160d8..8e8fb31b15a 100644 --- a/spec/frontend/ide/components/repo_editor_spec.js +++ b/spec/frontend/ide/components/repo_editor_spec.js @@ -63,8 +63,8 @@ const prepareStore = (state, activeFile) => { projects: { 'gitlab-org/gitlab': { branches: { - master: { - name: 'master', + main: { + name: 'main', commit: { id: 'abcdefgh', }, @@ -73,7 +73,7 @@ const prepareStore = (state, activeFile) => { }, }, currentProjectId: 'gitlab-org/gitlab', - currentBranchId: 'master', + currentBranchId: 'main', entries: { [activeFile.path]: activeFile, }, @@ -656,7 +656,7 @@ describe('RepoEditor', () => { }); it("does not add file to state or set markdown image syntax if the file isn't markdown", async () => { - wrapper.setProps({ + await wrapper.setProps({ file: setFileName('myfile.txt'), }); pasteImage(); diff --git a/spec/frontend/ide/ide_router_spec.js b/spec/frontend/ide/ide_router_spec.js index acab2c6aeef..3fb7781b176 100644 --- a/spec/frontend/ide/ide_router_spec.js +++ b/spec/frontend/ide/ide_router_spec.js @@ -18,14 +18,14 @@ describe('IDE router', () => { }); [ - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/master/-/src/blob/`, - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/master/-/src/blob`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/main/-/src/blob/`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/main/-/src/blob`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/blob/-/src/blob`, - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/master/-/src/tree/`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/main/-/src/tree/`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/weird:branch/name-123/-/src/tree/`, - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/master/-/src/blob`, - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/master/-/src/edit`, - `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/master/-/src/merge_requests/2`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/main/-/src/blob`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/main/-/src/edit`, + `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/main/-/src/merge_requests/2`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/blob/blob/-/src/blob`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/edit/blob/-/src/blob`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/merge_requests/2`, diff --git a/spec/frontend/ide/mock_data.js b/spec/frontend/ide/mock_data.js index c8925e6745d..557626b3cca 100644 --- a/spec/frontend/ide/mock_data.js +++ b/spec/frontend/ide/mock_data.js @@ -8,8 +8,8 @@ export const projectData = { path: '', name_with_namespace: 'namespace/abcproject', branches: { - master: { - treeId: 'abcproject/master', + main: { + treeId: 'abcproject/main', can_push: true, commit: { id: '123', @@ -19,13 +19,13 @@ export const projectData = { mergeRequests: {}, merge_requests_enabled: true, userPermissions: {}, - default_branch: 'master', + default_branch: 'main', }; export const pipelines = [ { id: 1, - ref: 'master', + ref: 'main', sha: '123', details: { status: { @@ -38,7 +38,7 @@ export const pipelines = [ }, { id: 2, - ref: 'master', + ref: 'main', sha: '213', details: { status: { @@ -178,9 +178,9 @@ export const mergeRequests = [ export const branches = [ { id: 1, - name: 'master', + name: 'main', commit: { - message: 'Update master branch', + message: 'Update main branch', committed_date: '2018-08-01T00:20:05Z', }, can_push: true, diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js index 4a726cff3b6..925446aa280 100644 --- a/spec/frontend/ide/services/index_spec.js +++ b/spec/frontend/ide/services/index_spec.js @@ -15,7 +15,7 @@ jest.mock('~/ide/services/gql'); const TEST_NAMESPACE = 'alice'; const TEST_PROJECT = 'wonderland'; const TEST_PROJECT_ID = `${TEST_NAMESPACE}/${TEST_PROJECT}`; -const TEST_BRANCH = 'master-patch-123'; +const TEST_BRANCH = 'main-patch-123'; const TEST_COMMIT_SHA = '123456789'; const TEST_FILE_PATH = 'README2.md'; const TEST_FILE_OLD_PATH = 'OLD_README2.md'; diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 6178fb08d8c..6b94d7cf6f1 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -29,7 +29,7 @@ describe('IDE store file actions', () => { store = createStore(); store.state.currentProjectId = 'test/test'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; router = createRouter(store); @@ -85,7 +85,7 @@ describe('IDE store file actions', () => { .dispatch('closeFile', localFile) .then(Vue.nextTick) .then(() => { - expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/master/-/newOpenFile/'); + expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/main/-/newOpenFile/'); }); }); @@ -177,11 +177,11 @@ describe('IDE store file actions', () => { store.state.entries[localFile.path] = localFile; store.state.currentProjectId = 'test/test'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects['test/test'] = { branches: { - master: { + main: { commit: { id: '7297abc', }, @@ -260,7 +260,7 @@ describe('IDE store file actions', () => { it('sets document title with the branchId', () => { return store.dispatch('getFileData', { path: localFile.path }).then(() => { - expect(document.title).toBe(`${localFile.path} · master · test/test · GitLab`); + expect(document.title).toBe(`${localFile.path} · main · test/test · GitLab`); }); }); @@ -329,7 +329,7 @@ describe('IDE store file actions', () => { it('sets document title considering `prevPath` on a file', () => { return store.dispatch('getFileData', { path: localFile.path }).then(() => { - expect(document.title).toBe(`new-shiny-file · master · test/test · GitLab`); + expect(document.title).toBe(`new-shiny-file · main · test/test · GitLab`); }); }); }); @@ -702,7 +702,7 @@ describe('IDE store file actions', () => { }); it('pushes route for active file', () => { - expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/master/-/tempFile/'); + expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/main/-/tempFile/'); }); }); }); @@ -778,7 +778,7 @@ describe('IDE store file actions', () => { it('pushes router URL when added', () => { return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(() => { - expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/master/'); + expect(router.push).toHaveBeenCalledWith('/project/test/test/tree/main/'); }); }); }); diff --git a/spec/frontend/ide/stores/actions/merge_request_spec.js b/spec/frontend/ide/stores/actions/merge_request_spec.js index 600bd5fe9e1..e62811a4517 100644 --- a/spec/frontend/ide/stores/actions/merge_request_spec.js +++ b/spec/frontend/ide/stores/actions/merge_request_spec.js @@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter'; import { range } from 'lodash'; import { TEST_HOST } from 'helpers/test_constants'; import testAction from 'helpers/vuex_action_helper'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import createFlash from '~/flash'; import { leftSidebarViews, PERMISSION_READ_MR, MAX_MR_FILES_AUTO_OPEN } from '~/ide/constants'; import service from '~/ide/services'; import { createStore } from '~/ide/stores'; @@ -145,7 +145,9 @@ describe('IDE store merge request actions', () => { .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .catch(() => { expect(createFlash).toHaveBeenCalled(); - expect(createFlash.mock.calls[0][0]).toBe('Error fetching merge requests for bar'); + expect(createFlash.mock.calls[0][0].message).toBe( + 'Error fetching merge requests for bar', + ); }) .then(done) .catch(done.fail); @@ -461,11 +463,11 @@ describe('IDE store merge request actions', () => { }; store.state.currentProjectId = 'test/test'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects['test/test'] = { branches: { - master: { + main: { commit: { id: '7297abc', }, @@ -562,7 +564,9 @@ describe('IDE store merge request actions', () => { openMergeRequest(store, mr) .catch(() => { - expect(createFlash).toHaveBeenCalledWith(expect.any(String)); + expect(createFlash).toHaveBeenCalledWith({ + message: expect.any(String), + }); }) .then(done) .catch(done.fail); diff --git a/spec/frontend/ide/stores/actions/project_spec.js b/spec/frontend/ide/stores/actions/project_spec.js index 23ffb5ff56b..ca6f7169059 100644 --- a/spec/frontend/ide/stores/actions/project_spec.js +++ b/spec/frontend/ide/stores/actions/project_spec.js @@ -37,11 +37,11 @@ describe('IDE store project actions', () => { describe('refreshLastCommitData', () => { beforeEach(() => { store.state.currentProjectId = 'abc/def'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects['abc/def'] = { id: 4, branches: { - master: { + main: { commit: null, }, }, @@ -60,7 +60,7 @@ describe('IDE store project actions', () => { branchId: store.state.currentBranchId, }) .then(() => { - expect(service.getBranchData).toHaveBeenCalledWith('abc/def', 'master'); + expect(service.getBranchData).toHaveBeenCalledWith('abc/def', 'main'); done(); }) @@ -81,7 +81,7 @@ describe('IDE store project actions', () => { type: 'SET_BRANCH_COMMIT', payload: { projectId: TEST_PROJECT_ID, - branchId: 'master', + branchId: 'main', commit: { id: '123' }, }, }, @@ -97,17 +97,17 @@ describe('IDE store project actions', () => { it('dispatches setErrorMessage', (done) => { testAction( showBranchNotFoundError, - 'master', + 'main', null, [], [ { type: 'setErrorMessage', payload: { - text: "Branch <strong>master</strong> was not found in this project's repository.", + text: "Branch <strong>main</strong> was not found in this project's repository.", action: expect.any(Function), actionText: 'Create branch', - actionPayload: 'master', + actionPayload: 'main', }, }, ], @@ -131,7 +131,7 @@ describe('IDE store project actions', () => { }, getters: { currentProject: { - default_branch: 'master', + default_branch: 'main', }, }, dispatch() {}, @@ -140,7 +140,7 @@ describe('IDE store project actions', () => { ) .then(() => { expect(api.createBranch).toHaveBeenCalledWith('project-path', { - ref: 'master', + ref: 'main', branch: 'new-branch-name', }); }) @@ -158,7 +158,7 @@ describe('IDE store project actions', () => { }, getters: { currentProject: { - default_branch: 'master', + default_branch: 'main', }, }, dispatch: dispatchSpy, @@ -180,7 +180,7 @@ describe('IDE store project actions', () => { }, getters: { currentProject: { - default_branch: 'master', + default_branch: 'main', }, }, dispatch() {}, @@ -199,13 +199,13 @@ describe('IDE store project actions', () => { it('creates a blank tree and sets loading state to false', (done) => { testAction( loadEmptyBranch, - { projectId: TEST_PROJECT_ID, branchId: 'master' }, + { projectId: TEST_PROJECT_ID, branchId: 'main' }, store.state, [ - { type: 'CREATE_TREE', payload: { treePath: `${TEST_PROJECT_ID}/master` } }, + { type: 'CREATE_TREE', payload: { treePath: `${TEST_PROJECT_ID}/main` } }, { type: 'TOGGLE_LOADING', - payload: { entry: store.state.trees[`${TEST_PROJECT_ID}/master`], forceValue: false }, + payload: { entry: store.state.trees[`${TEST_PROJECT_ID}/main`], forceValue: false }, }, ], expect.any(Object), @@ -214,11 +214,11 @@ describe('IDE store project actions', () => { }); it('does nothing, if tree already exists', (done) => { - const trees = { [`${TEST_PROJECT_ID}/master`]: [] }; + const trees = { [`${TEST_PROJECT_ID}/main`]: [] }; testAction( loadEmptyBranch, - { projectId: TEST_PROJECT_ID, branchId: 'master' }, + { projectId: TEST_PROJECT_ID, branchId: 'main' }, { trees }, [], [], diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js index 8de2188a5f4..8d7328725e9 100644 --- a/spec/frontend/ide/stores/actions/tree_spec.js +++ b/spec/frontend/ide/stores/actions/tree_spec.js @@ -18,8 +18,8 @@ describe('Multi-file store tree actions', () => { const basicCallParameters = { endpoint: 'rootEndpoint', projectId: 'abcproject', - branch: 'master', - branchId: 'master', + branch: 'main', + branchId: 'main', ref: '12345678', }; @@ -31,7 +31,7 @@ describe('Multi-file store tree actions', () => { mock = new MockAdapter(axios); store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; store.state.projects.abcproject = { web_url: '', path_with_namespace: 'foo/abcproject', @@ -66,7 +66,7 @@ describe('Multi-file store tree actions', () => { store .dispatch('getFiles', basicCallParameters) .then(() => { - projectTree = store.state.trees['abcproject/master']; + projectTree = store.state.trees['abcproject/main']; expect(projectTree.tree.length).toBe(2); expect(projectTree.tree[0].type).toBe('tree'); @@ -89,7 +89,7 @@ describe('Multi-file store tree actions', () => { 'abc/def': { web_url: `${TEST_HOST}/files`, branches: { - 'master-testing': { + 'main-testing': { commit: { id: '12345', }, @@ -98,7 +98,7 @@ describe('Multi-file store tree actions', () => { }, }; const getters = { - findBranch: () => store.state.projects['abc/def'].branches['master-testing'], + findBranch: () => store.state.projects['abc/def'].branches['main-testing'], }; mock.onGet(/(.*)/).replyOnce(500); @@ -112,7 +112,7 @@ describe('Multi-file store tree actions', () => { }, { projectId: 'abc/def', - branchId: 'master-testing', + branchId: 'main-testing', }, ) .then(done.fail) @@ -121,7 +121,7 @@ describe('Multi-file store tree actions', () => { text: 'An error occurred while loading all the files.', action: expect.any(Function), actionText: 'Please try again', - actionPayload: { projectId: 'abc/def', branchId: 'master-testing' }, + actionPayload: { projectId: 'abc/def', branchId: 'main-testing' }, }); done(); }); @@ -178,17 +178,17 @@ describe('Multi-file store tree actions', () => { describe('setDirectoryData', () => { it('sets tree correctly if there are no opened files yet', (done) => { const treeFile = file({ name: 'README.md' }); - store.state.trees['abcproject/master'] = {}; + store.state.trees['abcproject/main'] = {}; testAction( setDirectoryData, - { projectId: 'abcproject', branchId: 'master', treeList: [treeFile] }, + { projectId: 'abcproject', branchId: 'main', treeList: [treeFile] }, store.state, [ { type: types.SET_DIRECTORY_DATA, payload: { - treePath: 'abcproject/master', + treePath: 'abcproject/main', data: [treeFile], }, }, diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js index ad55313da93..e575667b8c6 100644 --- a/spec/frontend/ide/stores/actions_spec.js +++ b/spec/frontend/ide/stores/actions_spec.js @@ -777,7 +777,7 @@ describe('Multi-file store actions', () => { it('routes to the renamed file if the original file has been opened', (done) => { store.state.currentProjectId = 'test/test'; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; Object.assign(store.state.entries.orig, { opened: true, @@ -790,7 +790,7 @@ describe('Multi-file store actions', () => { }) .then(() => { expect(router.push.mock.calls).toHaveLength(1); - expect(router.push).toHaveBeenCalledWith(`/project/test/test/tree/master/-/renamed/`); + expect(router.push).toHaveBeenCalledWith(`/project/test/test/tree/main/-/renamed/`); }) .then(done) .catch(done.fail); @@ -1019,7 +1019,7 @@ describe('Multi-file store actions', () => { }, { projectId: 'abc/def', - branchId: 'master-testing', + branchId: 'main-testing', }, ]; dispatch = jest.fn(); diff --git a/spec/frontend/ide/stores/getters_spec.js b/spec/frontend/ide/stores/getters_spec.js index 06456cdb12a..53d161ae5c9 100644 --- a/spec/frontend/ide/stores/getters_spec.js +++ b/spec/frontend/ide/stores/getters_spec.js @@ -209,12 +209,12 @@ describe('IDE store getters', () => { describe('currentBranch', () => { it('returns current projects branch', () => { localState.currentProjectId = 'abcproject'; - localState.currentBranchId = 'master'; + localState.currentBranchId = 'main'; localState.projects.abcproject = { name: 'abcproject', branches: { - master: { - name: 'master', + main: { + name: 'main', }, }, }; @@ -223,7 +223,7 @@ describe('IDE store getters', () => { }; getters.currentBranch(localState, localGetters); - expect(localGetters.findBranch).toHaveBeenCalledWith('abcproject', 'master'); + expect(localGetters.findBranch).toHaveBeenCalledWith('abcproject', 'main'); }); }); @@ -243,12 +243,12 @@ describe('IDE store getters', () => { it('returns the selected branch from a project', () => { localState.currentProjectId = 'abcproject'; - localState.currentBranchId = 'master'; + localState.currentBranchId = 'main'; localState.projects.abcproject = { name: 'abcproject', branches: { - master: { - name: 'master', + main: { + name: 'main', }, }, }; @@ -256,9 +256,9 @@ describe('IDE store getters', () => { findProject: () => localState.projects.abcproject, }; - result = getters.findBranch(localState, localGetters)('abcproject', 'master'); + result = getters.findBranch(localState, localGetters)('abcproject', 'main'); - expect(result.name).toBe('master'); + expect(result.name).toBe('main'); }); }); @@ -274,9 +274,9 @@ describe('IDE store getters', () => { it("returns true when project's default branch matches current branch", () => { const localGetters = { currentProject: { - default_branch: 'master', + default_branch: 'main', }, - branchName: 'master', + branchName: 'main', }; expect(getters.isOnDefaultBranch({}, localGetters)).toBeTruthy(); @@ -285,7 +285,7 @@ describe('IDE store getters', () => { it("returns false when project's default branch doesn't match current branch", () => { const localGetters = { currentProject: { - default_branch: 'master', + default_branch: 'main', }, branchName: 'feature', }; @@ -620,10 +620,10 @@ describe('IDE store getters', () => { describe('getUrlForPath', () => { it('returns a route url for the given path', () => { localState.currentProjectId = 'test/test'; - localState.currentBranchId = 'master'; + localState.currentBranchId = 'main'; expect(localStore.getters.getUrlForPath('path/to/foo/bar-1.jpg')).toBe( - `/project/test/test/tree/master/-/path/to/foo/bar-1.jpg/`, + `/project/test/test/tree/main/-/path/to/foo/bar-1.jpg/`, ); }); }); @@ -631,13 +631,13 @@ describe('IDE store getters', () => { describe('getJsonSchemaForPath', () => { beforeEach(() => { localState.currentProjectId = 'path/to/some/project'; - localState.currentBranchId = 'master'; + localState.currentBranchId = 'main'; }); it('returns a json schema uri and match config for a json/yaml file that can be loaded by monaco', () => { expect(localStore.getters.getJsonSchemaForPath('.gitlab-ci.yml')).toEqual({ fileMatch: ['*.gitlab-ci.yml'], - uri: `${TEST_HOST}/path/to/some/project/-/schema/master/.gitlab-ci.yml`, + uri: `${TEST_HOST}/path/to/some/project/-/schema/main/.gitlab-ci.yml`, }); }); @@ -645,8 +645,8 @@ describe('IDE store getters', () => { localState.projects['path/to/some/project'] = { name: 'project', branches: { - master: { - name: 'master', + main: { + name: 'main', commit: { id: 'abcdef123456', }, diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js index b124eb391f3..cb6bb7c1202 100644 --- a/spec/frontend/ide/stores/modules/commit/actions_spec.js +++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js @@ -47,7 +47,7 @@ describe('IDE commit module actions', () => { jest.spyOn(router, 'push').mockImplementation(); mock - .onGet('/api/v1/projects/abcproject/repository/branches/master') + .onGet('/api/v1/projects/abcproject/repository/branches/main') .reply(200, { commit: COMMIT_RESPONSE }); }); @@ -101,7 +101,7 @@ describe('IDE commit module actions', () => { originalGon = window.gon; window.gon = { current_username: 'johndoe' }; - store.state.currentBranchId = 'master'; + store.state.currentBranchId = 'main'; }); afterEach(() => { @@ -177,7 +177,7 @@ describe('IDE commit module actions', () => { committed_date: '123', committer_name: 'root', }; - const branch = 'master'; + const branch = 'main'; let f; beforeEach(() => { @@ -192,12 +192,12 @@ describe('IDE commit module actions', () => { Object.assign(store.state, { currentProjectId: 'abcproject', - currentBranchId: 'master', + currentBranchId: 'main', projects: { abcproject: { web_url: 'web_url', branches: { - master: { + main: { workingReference: '', commit: { short_id: TEST_COMMIT_SHA, @@ -228,7 +228,7 @@ describe('IDE commit module actions', () => { branch, }) .then(() => { - expect(store.state.projects.abcproject.branches.master.workingReference).toBe(data.id); + expect(store.state.projects.abcproject.branches.main.workingReference).toBe(data.id); }) .then(done) .catch(done.fail); @@ -310,14 +310,14 @@ describe('IDE commit module actions', () => { changedFiles: [f], openFiles: [f], currentProjectId: 'abcproject', - currentBranchId: 'master', + currentBranchId: 'main', projects: { abcproject: { - default_branch: 'master', + default_branch: 'main', web_url: 'webUrl', branches: { - master: { - name: 'master', + main: { + name: 'main', workingReference: '1', commit: { id: TEST_COMMIT_SHA, @@ -460,7 +460,7 @@ describe('IDE commit module actions', () => { .dispatch('commit/commitChanges') .then(() => { expect(visitUrl).toHaveBeenCalledWith( - `webUrl/-/merge_requests/new?merge_request[source_branch]=${store.getters['commit/placeholderBranchName']}&merge_request[target_branch]=master&nav_source=webide`, + `webUrl/-/merge_requests/new?merge_request[source_branch]=${store.getters['commit/placeholderBranchName']}&merge_request[target_branch]=main&nav_source=webide`, ); done(); diff --git a/spec/frontend/ide/stores/modules/commit/getters_spec.js b/spec/frontend/ide/stores/modules/commit/getters_spec.js index 0dc938bb637..7a07ed05201 100644 --- a/spec/frontend/ide/stores/modules/commit/getters_spec.js +++ b/spec/frontend/ide/stores/modules/commit/getters_spec.js @@ -46,7 +46,7 @@ describe('IDE commit module getters', () => { describe('branchName', () => { const rootState = { - currentBranchId: 'master', + currentBranchId: 'main', }; const localGetters = { placeholderBranchName: 'placeholder-branch-name', @@ -61,7 +61,7 @@ describe('IDE commit module getters', () => { it('defaults to currentBranchId when not committing to a new branch', () => { localGetters.isCreatingNewBranch = false; - expect(getters.branchName(state, localGetters, rootState)).toBe('master'); + expect(getters.branchName(state, localGetters, rootState)).toBe('main'); }); describe('commit to a new branch', () => { diff --git a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js index e5887ca0a33..fc00bd075e7 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js @@ -13,7 +13,7 @@ import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; const TEST_PROJECT_PATH = 'lorem/root'; -const TEST_BRANCH_ID = 'master'; +const TEST_BRANCH_ID = 'main'; const TEST_YAML_HELP_PATH = `${TEST_HOST}/test/yaml/help`; const TEST_RUNNERS_HELP_PATH = `${TEST_HOST}/test/runners/help`; diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js index e42e760b841..ecda7f304ba 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import createFlash from '~/flash'; import * as actions from '~/ide/stores/modules/terminal/actions/session_controls'; import { STARTING, PENDING, STOPPING, STOPPED } from '~/ide/stores/modules/terminal/constants'; import * as messages from '~/ide/stores/modules/terminal/messages'; @@ -11,7 +11,7 @@ import httpStatus from '~/lib/utils/http_status'; jest.mock('~/flash'); const TEST_PROJECT_PATH = 'lorem/root'; -const TEST_BRANCH_ID = 'master'; +const TEST_BRANCH_ID = 'main'; const TEST_SESSION = { id: 7, status: PENDING, @@ -89,7 +89,9 @@ describe('IDE store terminal session controls actions', () => { it('flashes message', () => { actions.receiveStartSessionError({ dispatch }); - expect(createFlash).toHaveBeenCalledWith(messages.UNEXPECTED_ERROR_STARTING); + expect(createFlash).toHaveBeenCalledWith({ + message: messages.UNEXPECTED_ERROR_STARTING, + }); }); it('sets session status', () => { @@ -161,7 +163,9 @@ describe('IDE store terminal session controls actions', () => { it('flashes message', () => { actions.receiveStopSessionError({ dispatch }); - expect(createFlash).toHaveBeenCalledWith(messages.UNEXPECTED_ERROR_STOPPING); + expect(createFlash).toHaveBeenCalledWith({ + message: messages.UNEXPECTED_ERROR_STOPPING, + }); }); it('kills the session', () => { diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js index 0227955754c..eabc69b23aa 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import createFlash from '~/flash'; import * as actions from '~/ide/stores/modules/terminal/actions/session_status'; import { PENDING, RUNNING, STOPPING, STOPPED } from '~/ide/stores/modules/terminal/constants'; import * as messages from '~/ide/stores/modules/terminal/messages'; @@ -115,7 +115,9 @@ describe('IDE store terminal session controls actions', () => { it('flashes message', () => { actions.receiveSessionStatusError({ dispatch }); - expect(createFlash).toHaveBeenCalledWith(messages.UNEXPECTED_ERROR_STATUS); + expect(createFlash).toHaveBeenCalledWith({ + message: messages.UNEXPECTED_ERROR_STATUS, + }); }); it('kills the session', () => { diff --git a/spec/frontend/ide/stores/mutations/branch_spec.js b/spec/frontend/ide/stores/mutations/branch_spec.js index 0900b25d5d3..30a688d2bb0 100644 --- a/spec/frontend/ide/stores/mutations/branch_spec.js +++ b/spec/frontend/ide/stores/mutations/branch_spec.js @@ -10,9 +10,9 @@ describe('Multi-file store branch mutations', () => { describe('SET_CURRENT_BRANCH', () => { it('sets currentBranch', () => { - mutations.SET_CURRENT_BRANCH(localState, 'master'); + mutations.SET_CURRENT_BRANCH(localState, 'main'); - expect(localState.currentBranchId).toBe('master'); + expect(localState.currentBranchId).toBe('main'); }); }); @@ -21,20 +21,20 @@ describe('Multi-file store branch mutations', () => { localState.projects = { Example: { branches: { - master: {}, + main: {}, }, }, }; mutations.SET_BRANCH_COMMIT(localState, { projectId: 'Example', - branchId: 'master', + branchId: 'main', commit: { title: 'Example commit', }, }); - expect(localState.projects.Example.branches.master.commit.title).toBe('Example commit'); + expect(localState.projects.Example.branches.main.commit.title).toBe('Example commit'); }); }); diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js index 825d2a546cd..1453f26c1d9 100644 --- a/spec/frontend/ide/stores/mutations/file_spec.js +++ b/spec/frontend/ide/stores/mutations/file_spec.js @@ -319,8 +319,8 @@ describe('IDE store file mutations', () => { localFile.content = 'test'; localFile.changed = true; localState.currentProjectId = 'gitlab-ce'; - localState.currentBranchId = 'master'; - localState.trees['gitlab-ce/master'] = { + localState.currentBranchId = 'main'; + localState.trees['gitlab-ce/main'] = { tree: [], }; }); @@ -337,7 +337,7 @@ describe('IDE store file mutations', () => { mutations.DISCARD_FILE_CHANGES(localState, localFile.path); - expect(localState.trees['gitlab-ce/master'].tree).toEqual([{ ...localFile, deleted: false }]); + expect(localState.trees['gitlab-ce/main'].tree).toEqual([{ ...localFile, deleted: false }]); }); it('adds to parent tree if deleted', () => { diff --git a/spec/frontend/ide/stores/mutations/tree_spec.js b/spec/frontend/ide/stores/mutations/tree_spec.js index a4b98aa9d5a..6935e57578f 100644 --- a/spec/frontend/ide/stores/mutations/tree_spec.js +++ b/spec/frontend/ide/stores/mutations/tree_spec.js @@ -33,16 +33,16 @@ describe('Multi-file store tree mutations', () => { }); it('adds directory data', () => { - localState.trees['project/master'] = { + localState.trees['project/main'] = { tree: [], }; mutations.SET_DIRECTORY_DATA(localState, { data, - treePath: 'project/master', + treePath: 'project/main', }); - const tree = localState.trees['project/master']; + const tree = localState.trees['project/main']; expect(tree.tree.length).toBe(3); expect(tree.tree[0].name).toBe('tree'); @@ -52,30 +52,30 @@ describe('Multi-file store tree mutations', () => { it('keeps loading state', () => { mutations.CREATE_TREE(localState, { - treePath: 'project/master', + treePath: 'project/main', }); mutations.SET_DIRECTORY_DATA(localState, { data, - treePath: 'project/master', + treePath: 'project/main', }); - expect(localState.trees['project/master'].loading).toBe(true); + expect(localState.trees['project/main'].loading).toBe(true); }); it('does not override tree already in state, but merges the two with correct order', () => { const openedFile = file('new'); - localState.trees['project/master'] = { + localState.trees['project/main'] = { loading: true, tree: [openedFile], }; mutations.SET_DIRECTORY_DATA(localState, { data, - treePath: 'project/master', + treePath: 'project/main', }); - const { tree } = localState.trees['project/master']; + const { tree } = localState.trees['project/main']; expect(tree.length).toBe(4); expect(tree[0].name).toBe('blob'); @@ -86,17 +86,17 @@ describe('Multi-file store tree mutations', () => { it('returns tree unchanged if the opened file is already in the tree', () => { const openedFile = file('foo'); - localState.trees['project/master'] = { + localState.trees['project/main'] = { loading: true, tree: [openedFile], }; mutations.SET_DIRECTORY_DATA(localState, { data, - treePath: 'project/master', + treePath: 'project/main', }); - const { tree } = localState.trees['project/master']; + const { tree } = localState.trees['project/main']; expect(tree.length).toBe(3); diff --git a/spec/frontend/ide/stores/mutations_spec.js b/spec/frontend/ide/stores/mutations_spec.js index 09e9481e5d4..23fe23bdef9 100644 --- a/spec/frontend/ide/stores/mutations_spec.js +++ b/spec/frontend/ide/stores/mutations_spec.js @@ -98,8 +98,8 @@ describe('Multi-file store mutations', () => { describe('CREATE_TMP_ENTRY', () => { beforeEach(() => { localState.currentProjectId = 'gitlab-ce'; - localState.currentBranchId = 'master'; - localState.trees['gitlab-ce/master'] = { + localState.currentBranchId = 'main'; + localState.trees['gitlab-ce/main'] = { tree: [], }; }); @@ -115,7 +115,7 @@ describe('Multi-file store mutations', () => { }, }); - expect(localState.trees['gitlab-ce/master'].tree.length).toEqual(1); + expect(localState.trees['gitlab-ce/main'].tree.length).toEqual(1); expect(localState.entries.test.tempFile).toEqual(true); }); }); @@ -163,8 +163,8 @@ describe('Multi-file store mutations', () => { describe('DELETE_ENTRY', () => { beforeEach(() => { localState.currentProjectId = 'gitlab-ce'; - localState.currentBranchId = 'master'; - localState.trees['gitlab-ce/master'] = { + localState.currentBranchId = 'main'; + localState.trees['gitlab-ce/main'] = { tree: [], }; }); @@ -184,11 +184,11 @@ describe('Multi-file store mutations', () => { path: 'filePath', deleted: false, }; - localState.trees['gitlab-ce/master'].tree.push(localState.entries.filePath); + localState.trees['gitlab-ce/main'].tree.push(localState.entries.filePath); mutations.DELETE_ENTRY(localState, 'filePath'); - expect(localState.trees['gitlab-ce/master'].tree).toEqual([]); + expect(localState.trees['gitlab-ce/main'].tree).toEqual([]); }); it('removes from parent tree', () => { @@ -279,12 +279,12 @@ describe('Multi-file store mutations', () => { describe('RENAME_ENTRY', () => { beforeEach(() => { localState.trees = { - 'gitlab-ce/master': { + 'gitlab-ce/main': { tree: [], }, }; localState.currentProjectId = 'gitlab-ce'; - localState.currentBranchId = 'master'; + localState.currentBranchId = 'main'; localState.entries = { oldPath: file('oldPath', 'oldPath', 'blob'), }; @@ -462,7 +462,7 @@ describe('Multi-file store mutations', () => { gamma, }; - localState.trees['gitlab-ce/master'].tree = [alpha, beta, gamma]; + localState.trees['gitlab-ce/main'].tree = [alpha, beta, gamma]; mutations.RENAME_ENTRY(localState, { path: 'alpha', @@ -471,7 +471,7 @@ describe('Multi-file store mutations', () => { parentPath: '', }); - expect(localState.trees['gitlab-ce/master'].tree).toEqual([ + expect(localState.trees['gitlab-ce/main'].tree).toEqual([ expect.objectContaining({ name: 'beta', }), diff --git a/spec/frontend/ide/stores/utils_spec.js b/spec/frontend/ide/stores/utils_spec.js index 46a0794b2e6..8f7b8c5e311 100644 --- a/spec/frontend/ide/stores/utils_spec.js +++ b/spec/frontend/ide/stores/utils_spec.js @@ -18,13 +18,13 @@ describe('Multi-file store utils', () => { }; const state = { - currentBranchId: 'master', + currentBranchId: 'main', currentProjectId: 'test/test', }; utils.setPageTitleForFile(state, f); - expect(document.title).toBe('README.md · master · test/test · GitLab'); + expect(document.title).toBe('README.md · main · test/test · GitLab'); }); }); @@ -52,10 +52,10 @@ describe('Multi-file store utils', () => { { ...file('deletedFile'), path: 'deletedFile', deleted: true }, { ...file('renamedFile'), path: 'renamedFile', prevPath: 'prevPath' }, ], - currentBranchId: 'master', + currentBranchId: 'main', }; const payload = utils.createCommitPayload({ - branch: 'master', + branch: 'main', newBranch: false, state, rootState, @@ -63,7 +63,7 @@ describe('Multi-file store utils', () => { }); expect(payload).toEqual({ - branch: 'master', + branch: 'main', commit_message: 'commit message', actions: [ { @@ -122,10 +122,10 @@ describe('Multi-file store utils', () => { lastCommitSha: '123456789', }, ], - currentBranchId: 'master', + currentBranchId: 'main', }; const payload = utils.createCommitPayload({ - branch: 'master', + branch: 'main', newBranch: false, state: {}, rootState, @@ -135,7 +135,7 @@ describe('Multi-file store utils', () => { }); expect(payload).toEqual({ - branch: 'master', + branch: 'main', commit_message: 'prebuilt test commit message', actions: [ { @@ -377,7 +377,7 @@ describe('Multi-file store utils', () => { let localState; let branchInfo; const currentProjectId = '123-foo'; - const currentBranchId = 'master'; + const currentBranchId = 'main'; beforeEach(() => { localState = { diff --git a/spec/frontend/ide/utils_spec.js b/spec/frontend/ide/utils_spec.js index f467d174eeb..00733615f81 100644 --- a/spec/frontend/ide/utils_spec.js +++ b/spec/frontend/ide/utils_spec.js @@ -274,33 +274,33 @@ describe('WebIDE utils', () => { * hello.md -> hello-1.md * hello_2.md -> hello_3.md * hello_ -> hello_1 - * master-patch-22432 -> master-patch-22433 + * main-patch-22432 -> main-patch-22433 * patch_332 -> patch_333 */ describe('addNumericSuffix', () => { it.each` - input | output - ${'hello'} | ${'hello-1'} - ${'hello2'} | ${'hello-3'} - ${'hello.md'} | ${'hello-1.md'} - ${'hello_2.md'} | ${'hello_3.md'} - ${'hello_'} | ${'hello_1'} - ${'master-patch-22432'} | ${'master-patch-22433'} - ${'patch_332'} | ${'patch_333'} + input | output + ${'hello'} | ${'hello-1'} + ${'hello2'} | ${'hello-3'} + ${'hello.md'} | ${'hello-1.md'} + ${'hello_2.md'} | ${'hello_3.md'} + ${'hello_'} | ${'hello_1'} + ${'main-patch-22432'} | ${'main-patch-22433'} + ${'patch_332'} | ${'patch_333'} `('adds a numeric suffix to a given filename/branch name: $input', ({ input, output }) => { expect(addNumericSuffix(input)).toBe(output); }); it.each` - input | output - ${'hello'} | ${'hello-39135'} - ${'hello2'} | ${'hello-39135'} - ${'hello.md'} | ${'hello-39135.md'} - ${'hello_2.md'} | ${'hello_39135.md'} - ${'hello_'} | ${'hello_39135'} - ${'master-patch-22432'} | ${'master-patch-39135'} - ${'patch_332'} | ${'patch_39135'} + input | output + ${'hello'} | ${'hello-39135'} + ${'hello2'} | ${'hello-39135'} + ${'hello.md'} | ${'hello-39135.md'} + ${'hello_2.md'} | ${'hello_39135.md'} + ${'hello_'} | ${'hello_39135'} + ${'main-patch-22432'} | ${'main-patch-39135'} + ${'patch_332'} | ${'patch_39135'} `('adds a random suffix if randomize=true is passed for name: $input', ({ input, output }) => { jest.spyOn(Math, 'random').mockReturnValue(0.391352525); |