diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-15 21:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-15 21:10:04 +0300 |
commit | 5ff1f808adf841bca979cb2fac6bdfa9c449d028 (patch) | |
tree | c95cfbbcb400684b2bc89fee4fc7b614315ba909 /spec/frontend/jobs | |
parent | f8a5275c45ed2276daf843764113476749e680d2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jobs')
3 files changed, 28 insertions, 11 deletions
diff --git a/spec/frontend/jobs/components/job/manual_variables_form_spec.js b/spec/frontend/jobs/components/job/manual_variables_form_spec.js index c8c865dd28e..a48155d93ac 100644 --- a/spec/frontend/jobs/components/job/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/job/manual_variables_form_spec.js @@ -9,7 +9,7 @@ import { TYPENAME_CI_BUILD } from '~/graphql_shared/constants'; import { JOB_GRAPHQL_ERRORS } from '~/jobs/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; import waitForPromises from 'helpers/wait_for_promises'; -import { redirectTo } from '~/lib/utils/url_utility'; +import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated import ManualVariablesForm from '~/jobs/components/job/manual_variables_form.vue'; import getJobQuery from '~/jobs/components/job/graphql/queries/get_job.query.graphql'; import playJobMutation from '~/jobs/components/job/graphql/mutations/job_play_with_variables.mutation.graphql'; @@ -192,7 +192,7 @@ describe('Manual Variables Form', () => { await waitForPromises(); expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledTimes(1); - expect(redirectTo).toHaveBeenCalledWith(mockJobPlayMutationData.data.jobPlay.job.webPath); + expect(redirectTo).toHaveBeenCalledWith(mockJobPlayMutationData.data.jobPlay.job.webPath); // eslint-disable-line import/no-deprecated }); }); @@ -227,7 +227,7 @@ describe('Manual Variables Form', () => { await waitForPromises(); expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledTimes(1); - expect(redirectTo).toHaveBeenCalledWith(mockJobRetryMutationData.data.jobRetry.job.webPath); + expect(redirectTo).toHaveBeenCalledWith(mockJobRetryMutationData.data.jobRetry.job.webPath); // eslint-disable-line import/no-deprecated }); }); diff --git a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js index dd5a9e3491d..fd27004816a 100644 --- a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js +++ b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js @@ -1,5 +1,4 @@ -import { GlLink } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import SidebarDetailRow from '~/jobs/components/job/sidebar/sidebar_detail_row.vue'; describe('Sidebar detail row', () => { @@ -8,18 +7,20 @@ describe('Sidebar detail row', () => { const title = 'this is the title'; const value = 'this is the value'; const helpUrl = 'https://docs.gitlab.com/runner/register/index.html'; + const path = 'path/to/value'; - const findHelpLink = () => wrapper.findComponent(GlLink); + const findHelpLink = () => wrapper.findByTestId('job-sidebar-help-link'); + const findValueLink = () => wrapper.findByTestId('job-sidebar-value-link'); const createComponent = (props) => { - wrapper = shallowMount(SidebarDetailRow, { + wrapper = shallowMountExtended(SidebarDetailRow, { propsData: { ...props, }, }); }; - describe('with title/value and without helpUrl', () => { + describe('with title/value and without helpUrl/path', () => { beforeEach(() => { createComponent({ title, value }); }); @@ -31,6 +32,10 @@ describe('Sidebar detail row', () => { it('should not render the help link', () => { expect(findHelpLink().exists()).toBe(false); }); + + it('should not render the value link', () => { + expect(findValueLink().exists()).toBe(false); + }); }); describe('when helpUrl provided', () => { @@ -47,4 +52,16 @@ describe('Sidebar detail row', () => { expect(findHelpLink().attributes('href')).toBe(helpUrl); }); }); + + describe('when path is provided', () => { + it('should render link to value', () => { + createComponent({ + path, + title, + value, + }); + + expect(findValueLink().attributes('href')).toBe(path); + }); + }); }); diff --git a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js index 79bc765f181..f2d249b6014 100644 --- a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js +++ b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js @@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import { redirectTo } from '~/lib/utils/url_utility'; +import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated import ActionsCell from '~/jobs/components/table/cells/actions_cell.vue'; import eventHub from '~/jobs/components/table/event_hub'; import JobPlayMutation from '~/jobs/components/table/graphql/mutations/job_play.mutation.graphql'; @@ -146,7 +146,7 @@ describe('Job actions cell', () => { await waitForPromises(); expect(eventHub.$emit).toHaveBeenCalledWith('jobActionPerformed'); - expect(redirectTo).not.toHaveBeenCalled(); + expect(redirectTo).not.toHaveBeenCalled(); // eslint-disable-line import/no-deprecated }, ); @@ -165,7 +165,7 @@ describe('Job actions cell', () => { await waitForPromises(); - expect(redirectTo).toHaveBeenCalledWith(redirectLink); + expect(redirectTo).toHaveBeenCalledWith(redirectLink); // eslint-disable-line import/no-deprecated expect(eventHub.$emit).not.toHaveBeenCalled(); }, ); |