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>2023-03-20 21:08:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-20 21:08:18 +0300
commit96b01499986c01d0c95176860a7606b7616a3836 (patch)
treef394d46a0f7043984ddd5d51f8c408df035a5b89 /spec/frontend/ci/pipeline_editor
parent849e6f56ae6d29014a6d73f0533144adc9619e87 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci/pipeline_editor')
-rw-r--r--spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item_spec.js3
-rw-r--r--spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js33
-rw-r--r--spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js7
3 files changed, 19 insertions, 24 deletions
diff --git a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item_spec.js b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item_spec.js
index eaad0dae90d..373fb1b70c7 100644
--- a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item_spec.js
+++ b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item_spec.js
@@ -1,4 +1,3 @@
-import createStore from '~/ci/pipeline_editor/store';
import JobSetupItem from '~/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item.vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { JOB_TEMPLATE } from '~/ci/pipeline_editor/components/job_assistant_drawer/constants';
@@ -18,8 +17,8 @@ describe('Job setup item', () => {
const createComponent = () => {
wrapper = shallowMountExtended(JobSetupItem, {
- store: createStore(),
propsData: {
+ availableStages: ['.pre', dummyJobStage, '.post'],
tagOptions: [
{ id: 'tag1', name: 'tag1' },
{ id: 'tag2', name: 'tag2' },
diff --git a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js
index b293805d653..e47cf0156ad 100644
--- a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js
+++ b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js
@@ -8,8 +8,11 @@ import ImageItem from '~/ci/pipeline_editor/components/job_assistant_drawer/acco
import getAllRunners from '~/ci/runner/graphql/list/all_runners.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
-import createStore from '~/ci/pipeline_editor/store';
-import { mockAllRunnersQueryResponse } from 'jest/ci/pipeline_editor/mock_data';
+import {
+ mockAllRunnersQueryResponse,
+ mockLintResponse,
+ mockCiYml,
+} from 'jest/ci/pipeline_editor/mock_data';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import eventHub, { SCROLL_EDITOR_TO_BOTTOM } from '~/ci/pipeline_editor/event_hub';
@@ -37,8 +40,9 @@ describe('Job assistant drawer', () => {
]);
wrapper = mountExtended(JobAssistantDrawer, {
- store: createStore(),
propsData: {
+ ciConfigData: mockLintResponse,
+ ciFileContent: mockCiYml,
isVisible: true,
},
apolloProvider: mockApollo,
@@ -75,7 +79,6 @@ describe('Job assistant drawer', () => {
});
it('trigger validate if job name is empty', async () => {
- const updateCiConfigSpy = jest.spyOn(wrapper.vm, 'updateCiConfig');
findJobSetupItem().vm.$emit('update-job', 'script', 'b');
findConfirmButton().trigger('click');
@@ -83,7 +86,7 @@ describe('Job assistant drawer', () => {
expect(findJobSetupItem().props('isNameValid')).toBe(false);
expect(findJobSetupItem().props('isScriptValid')).toBe(true);
- expect(updateCiConfigSpy).toHaveBeenCalledTimes(0);
+ expect(wrapper.emitted('updateCiConfig')).toBeUndefined();
});
describe('when enter valid input', () => {
@@ -130,18 +133,18 @@ describe('Job assistant drawer', () => {
});
it('should update correct ci content when click add button', () => {
- const updateCiConfigSpy = jest.spyOn(wrapper.vm, 'updateCiConfig');
-
findConfirmButton().trigger('click');
- expect(updateCiConfigSpy).toHaveBeenCalledWith(
- `\n${stringify({
- [dummyJobName]: {
- script: dummyJobScript,
- image: { name: dummyImageName, entrypoint: [dummyImageEntrypoint] },
- },
- })}`,
- );
+ expect(wrapper.emitted('updateCiConfig')).toStrictEqual([
+ [
+ `${wrapper.props('ciFileContent')}\n${stringify({
+ [dummyJobName]: {
+ script: dummyJobScript,
+ image: { name: dummyImageName, entrypoint: [dummyImageEntrypoint] },
+ },
+ })}`,
+ ],
+ ]);
});
it('should emit scroll editor to button event when click add button', () => {
diff --git a/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js
index 7a13bfbd1ab..d22a1832343 100644
--- a/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js
+++ b/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js
@@ -8,7 +8,6 @@ import waitForPromises from 'helpers/wait_for_promises';
import { HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status';
import { objectToQuery, redirectTo } from '~/lib/utils/url_utility';
import { resolvers } from '~/ci/pipeline_editor/graphql/resolvers';
-import createStore from '~/ci/pipeline_editor/store';
import PipelineEditorTabs from '~/ci/pipeline_editor/components/pipeline_editor_tabs.vue';
import PipelineEditorEmptyState from '~/ci/pipeline_editor/components/ui/pipeline_editor_empty_state.vue';
import PipelineEditorMessages from '~/ci/pipeline_editor/components/ui/pipeline_editor_messages.vue';
@@ -81,9 +80,7 @@ describe('Pipeline editor app component', () => {
provide = {},
stubs = {},
} = {}) => {
- const store = createStore();
wrapper = shallowMount(PipelineEditorApp, {
- store,
provide: { ...defaultProvide, ...provide },
stubs,
mocks: {
@@ -255,10 +252,6 @@ describe('Pipeline editor app component', () => {
.mockImplementation(jest.fn());
});
- it('available stages is updated', () => {
- expect(wrapper.vm.$store.state.availableStages).toStrictEqual(['test', 'build']);
- });
-
it('shows pipeline editor home component', () => {
expect(findEditorHome().exists()).toBe(true);
});