Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/ide/stores/actions')
-rw-r--r--spec/frontend/ide/stores/actions/file_spec.js16
-rw-r--r--spec/frontend/ide/stores/actions/merge_request_spec.js14
-rw-r--r--spec/frontend/ide/stores/actions/project_spec.js32
-rw-r--r--spec/frontend/ide/stores/actions/tree_spec.js22
4 files changed, 44 insertions, 40 deletions
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],
},
},