diff options
Diffstat (limited to 'spec/frontend/jobs/components/job/manual_variables_form_spec.js')
-rw-r--r-- | spec/frontend/jobs/components/job/manual_variables_form_spec.js | 19 |
1 files changed, 17 insertions, 2 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 3040570df19..a5b3b0e3b47 100644 --- a/spec/frontend/jobs/components/job/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/job/manual_variables_form_spec.js @@ -4,9 +4,10 @@ import VueApollo from 'vue-apollo'; import { nextTick } from 'vue'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; +import { TYPENAME_CI_BUILD } from '~/graphql_shared/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; -import { GRAPHQL_ID_TYPES } from '~/jobs/constants'; import waitForPromises from 'helpers/wait_for_promises'; +import { redirectTo } from '~/lib/utils/url_utility'; import ManualVariablesForm from '~/jobs/components/job/manual_variables_form.vue'; import getJobQuery from '~/jobs/components/job/graphql/queries/get_job.query.graphql'; import retryJobMutation from '~/jobs/components/job/graphql/mutations/job_retry_with_variables.mutation.graphql'; @@ -21,6 +22,11 @@ import { const localVue = createLocalVue(); localVue.use(VueApollo); +jest.mock('~/lib/utils/url_utility', () => ({ + ...jest.requireActual('~/lib/utils/url_utility'), + redirectTo: jest.fn(), +})); + const defaultProvide = { projectPath: mockFullPath, }; @@ -146,7 +152,7 @@ describe('Manual Variables Form', () => { expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({ mutation: retryJobMutation, variables: { - id: convertToGraphQLId(GRAPHQL_ID_TYPES.ciBuild, mockId), + id: convertToGraphQLId(TYPENAME_CI_BUILD, mockId), variables: [ { key: 'new key', @@ -156,6 +162,15 @@ describe('Manual Variables Form', () => { }, }); }); + + // redirect to job after initial trigger assertion will be added in https://gitlab.com/gitlab-org/gitlab/-/issues/377268 + it('redirects to job properly after rerun', async () => { + findRerunBtn().vm.$emit('click'); + await waitForPromises(); + + expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledTimes(1); + expect(redirectTo).toHaveBeenCalledWith(mockJobMutationData.data.jobRetry.job.webPath); + }); }); describe('updating variables in UI', () => { |