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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-15 18:09:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-15 18:09:41 +0300
commit1581767ea15fcfa63919d39c0d3579da0a4de96e (patch)
tree4df66765670360645ffc77a9e402092ab52c14f5 /spec/frontend/pipeline_editor
parent01d2d6c8695d03440d68b262806f709b57da63b4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipeline_editor')
-rw-r--r--spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js31
-rw-r--r--spec/frontend/pipeline_editor/pipeline_editor_app_spec.js10
2 files changed, 11 insertions, 30 deletions
diff --git a/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js b/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js
index b797a664b75..7dd8a77d055 100644
--- a/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js
+++ b/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js
@@ -1,12 +1,10 @@
-import { GlIcon, GlAlert } from '@gitlab/ui';
+import { GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { EDITOR_READY_EVENT } from '~/editor/constants';
import CiConfigMergedPreview from '~/pipeline_editor/components/editor/ci_config_merged_preview.vue';
import { mockLintResponse, mockCiConfigPath } from '../../mock_data';
-const DEFAULT_BRANCH = 'main';
-
describe('Text editor component', () => {
let wrapper;
@@ -18,7 +16,7 @@ describe('Text editor component', () => {
},
};
- const createComponent = ({ props = {}, currentBranch = DEFAULT_BRANCH } = {}) => {
+ const createComponent = ({ props = {} } = {}) => {
wrapper = shallowMount(CiConfigMergedPreview, {
propsData: {
ciConfigData: mockLintResponse,
@@ -26,45 +24,20 @@ describe('Text editor component', () => {
},
provide: {
ciConfigPath: mockCiConfigPath,
- defaultBranch: DEFAULT_BRANCH,
},
stubs: {
SourceEditor: MockSourceEditor,
},
- data() {
- return {
- currentBranch,
- };
- },
});
};
const findIcon = () => wrapper.findComponent(GlIcon);
- const findAlert = () => wrapper.findComponent(GlAlert);
const findEditor = () => wrapper.findComponent(MockSourceEditor);
afterEach(() => {
wrapper.destroy();
});
- // This is testing a temporary feature.
- // It may be slightly hacky code that doesn't follow best practice.
- // See the related MR for more information.
- // https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65972#note_626095644
- describe('on a non-default branch', () => {
- beforeEach(() => {
- createComponent({ currentBranch: 'feature' });
- });
-
- it('does not load the editor', () => {
- expect(findEditor().exists()).toBe(false);
- });
-
- it('renders an informational alert', () => {
- expect(findAlert().exists()).toBe(true);
- });
- });
-
describe('when status is valid', () => {
beforeEach(() => {
createComponent();
diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
index 3dd09c583d6..b0d1a69ee56 100644
--- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
+++ b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
@@ -23,9 +23,10 @@ import {
mockBlobContentQueryResponse,
mockBlobContentQueryResponseEmptyCiFile,
mockBlobContentQueryResponseNoCiFile,
+ mockCiYml,
+ mockCommitSha,
mockDefaultBranch,
mockProjectFullPath,
- mockCiYml,
mockNewCommitShaResults,
} from './mock_data';
@@ -95,10 +96,16 @@ describe('Pipeline editor app component', () => {
];
const resolvers = {
+ Query: {
+ commitSha() {
+ return mockCommitSha;
+ },
+ },
Mutation: {
updateCommitSha: mockUpdateCommitSha,
},
};
+
mockApollo = createMockApollo(handlers, resolvers);
const options = {
@@ -170,6 +177,7 @@ describe('Pipeline editor app component', () => {
expect(mockCiConfigData).toHaveBeenCalledWith({
content: mockCiYml,
projectPath: mockProjectFullPath,
+ sha: mockCommitSha,
});
});
});