diff options
Diffstat (limited to 'spec/frontend/pipelines/pipelines_spec.js')
-rw-r--r-- | spec/frontend/pipelines/pipelines_spec.js | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js index c024730570c..20ed12cd1f5 100644 --- a/spec/frontend/pipelines/pipelines_spec.js +++ b/spec/frontend/pipelines/pipelines_spec.js @@ -10,7 +10,6 @@ import { TEST_HOST } from 'helpers/test_constants'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import Api from '~/api'; -import { getExperimentData, getExperimentVariant } from '~/experimentation/utils'; import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; import NavigationControls from '~/pipelines/components/pipelines_list/nav_controls.vue'; @@ -25,14 +24,10 @@ import TablePagination from '~/vue_shared/components/pagination/table_pagination import { stageReply, users, mockSearch, branches } from './mock_data'; jest.mock('~/flash'); -jest.mock('~/experimentation/utils', () => ({ - ...jest.requireActual('~/experimentation/utils'), - getExperimentData: jest.fn().mockReturnValue(false), - getExperimentVariant: jest.fn().mockReturnValue('control'), -})); const mockProjectPath = 'twitter/flight'; const mockProjectId = '21'; +const mockDefaultBranchName = 'main'; const mockPipelinesEndpoint = `/${mockProjectPath}/pipelines.json`; const mockPipelinesIds = mockPipelinesResponse.pipelines.map(({ id }) => id); const mockPipelineWithStages = mockPipelinesResponse.pipelines.find( @@ -50,7 +45,6 @@ describe('Pipelines', () => { ciLintPath: '/ci/lint', resetCachePath: `${mockProjectPath}/settings/ci_cd/reset_cache`, newPipelinePath: `${mockProjectPath}/pipelines/new`, - codeQualityPagePath: `${mockProjectPath}/-/new/master?commit_message=Add+.gitlab-ci.yml+and+create+a+code+quality+job&file_name=.gitlab-ci.yml&template=Code-Quality`, ciRunnerSettingsPath: `${mockProjectPath}/-/settings/ci_cd#js-runners-settings`, }; @@ -92,6 +86,7 @@ describe('Pipelines', () => { propsData: { store: new Store(), projectId: mockProjectId, + defaultBranchName: mockDefaultBranchName, endpoint: mockPipelinesEndpoint, params: {}, ...props, @@ -557,73 +552,6 @@ describe('Pipelines', () => { expect(wrapper.findComponent(PipelinesCiTemplates).exists()).toBe(true); }); - describe('when the code_quality_walkthrough experiment is active', () => { - beforeAll(() => { - getExperimentData.mockImplementation((name) => name === 'code_quality_walkthrough'); - }); - - describe('the control state', () => { - beforeAll(() => { - getExperimentVariant.mockReturnValue('control'); - }); - - it('renders the CI/CD templates', () => { - expect(wrapper.findComponent(PipelinesCiTemplates).exists()).toBe(true); - }); - }); - - describe('the candidate state', () => { - beforeAll(() => { - getExperimentVariant.mockReturnValue('candidate'); - }); - - it('renders another CTA button', () => { - expect(findEmptyState().findComponent(GlButton).text()).toBe('Add a code quality job'); - expect(findEmptyState().findComponent(GlButton).attributes('href')).toBe( - paths.codeQualityPagePath, - ); - }); - }); - }); - - describe('when the ci_runner_templates experiment is active', () => { - beforeAll(() => { - getExperimentData.mockImplementation((name) => name === 'ci_runner_templates'); - }); - - describe('the control state', () => { - beforeAll(() => { - getExperimentVariant.mockReturnValue('control'); - }); - - it('renders the CI/CD templates', () => { - expect(wrapper.findComponent(PipelinesCiTemplates).exists()).toBe(true); - }); - }); - - describe('the candidate state', () => { - beforeAll(() => { - getExperimentVariant.mockReturnValue('candidate'); - }); - - it('renders two buttons', () => { - expect(findEmptyState().findAllComponents(GlButton).length).toBe(2); - expect(findEmptyState().findAllComponents(GlButton).at(0).text()).toBe( - 'Install GitLab Runners', - ); - expect(findEmptyState().findAllComponents(GlButton).at(0).attributes('href')).toBe( - paths.ciRunnerSettingsPath, - ); - expect(findEmptyState().findAllComponents(GlButton).at(1).text()).toBe( - 'Learn about Runners', - ); - expect(findEmptyState().findAllComponents(GlButton).at(1).attributes('href')).toBe( - '/help/ci/quick_start/index.md', - ); - }); - }); - }); - it('does not render filtered search', () => { expect(findFilteredSearch().exists()).toBe(false); }); |