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-06-29 15:08:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-29 15:08:48 +0300
commite5f2a04e9d54615fded2ca05d0d5eef464795a8f (patch)
tree5412fccdb0a63b449fba4d7998eaa05ca70091ba /spec/frontend/pipeline_editor
parentad2789aeba21edaadcbdc06523462e6fd87d4ba1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipeline_editor')
-rw-r--r--spec/frontend/pipeline_editor/pipeline_editor_app_spec.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
index 7a74a8a3bde..eaf7d5e36a1 100644
--- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
+++ b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
@@ -12,6 +12,7 @@ import PipelineEditorMessages from '~/pipeline_editor/components/ui/pipeline_edi
import { COMMIT_SUCCESS, COMMIT_FAILURE } from '~/pipeline_editor/constants';
import getBlobContent from '~/pipeline_editor/graphql/queries/blob_content.graphql';
import getCiConfigData from '~/pipeline_editor/graphql/queries/ci_config.graphql';
+import getTemplate from '~/pipeline_editor/graphql/queries/get_starter_template.query.graphql';
import PipelineEditorApp from '~/pipeline_editor/pipeline_editor_app.vue';
import PipelineEditorHome from '~/pipeline_editor/pipeline_editor_home.vue';
import {
@@ -47,6 +48,7 @@ describe('Pipeline editor app component', () => {
let mockApollo;
let mockBlobContentData;
let mockCiConfigData;
+ let mockGetTemplate;
const createComponent = ({ blobLoading = false, options = {}, provide = {} } = {}) => {
wrapper = shallowMount(PipelineEditorApp, {
@@ -81,6 +83,7 @@ describe('Pipeline editor app component', () => {
const handlers = [
[getBlobContent, mockBlobContentData],
[getCiConfigData, mockCiConfigData],
+ [getTemplate, mockGetTemplate],
];
mockApollo = createMockApollo(handlers);
@@ -112,6 +115,7 @@ describe('Pipeline editor app component', () => {
beforeEach(() => {
mockBlobContentData = jest.fn();
mockCiConfigData = jest.fn();
+ mockGetTemplate = jest.fn();
});
afterEach(() => {
@@ -318,4 +322,29 @@ describe('Pipeline editor app component', () => {
expect(findEditorHome().exists()).toBe(true);
});
});
+
+ describe('when a template parameter is present in the URL', () => {
+ const { location } = window;
+
+ beforeEach(() => {
+ delete window.location;
+ window.location = new URL('https://localhost?template=Android');
+ });
+
+ afterEach(() => {
+ window.location = location;
+ });
+
+ it('renders the given template', async () => {
+ await createComponentWithApollo();
+
+ expect(mockGetTemplate).toHaveBeenCalledWith({
+ projectPath: mockProjectFullPath,
+ templateName: 'Android',
+ });
+
+ expect(findEmptyState().exists()).toBe(false);
+ expect(findTextEditor().exists()).toBe(true);
+ });
+ });
});