diff options
Diffstat (limited to 'spec/frontend/pipelines/graph/graph_view_selector_spec.js')
-rw-r--r-- | spec/frontend/pipelines/graph/graph_view_selector_spec.js | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/spec/frontend/pipelines/graph/graph_view_selector_spec.js b/spec/frontend/pipelines/graph/graph_view_selector_spec.js index 1397500bdc7..43587bebedf 100644 --- a/spec/frontend/pipelines/graph/graph_view_selector_spec.js +++ b/spec/frontend/pipelines/graph/graph_view_selector_spec.js @@ -1,34 +1,23 @@ import { GlAlert, GlButton, GlButtonGroup, GlLoadingIcon } from '@gitlab/ui'; import { mount, shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; -import VueApollo from 'vue-apollo'; -import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import { LAYER_VIEW, STAGE_VIEW } from '~/pipelines/components/graph/constants'; import GraphViewSelector from '~/pipelines/components/graph/graph_view_selector.vue'; -import createMockApollo from 'helpers/mock_apollo_helper'; -import getPerformanceInsights from '~/pipelines/graphql/queries/get_performance_insights.query.graphql'; -import { mockPerformanceInsightsResponse } from './mock_data'; - -Vue.use(VueApollo); describe('the graph view selector component', () => { let wrapper; - let trackingSpy; const findDependenciesToggle = () => wrapper.find('[data-testid="show-links-toggle"]'); const findViewTypeSelector = () => wrapper.findComponent(GlButtonGroup); const findStageViewButton = () => findViewTypeSelector().findAllComponents(GlButton).at(0); const findLayerViewButton = () => findViewTypeSelector().findAllComponents(GlButton).at(1); const findSwitcherLoader = () => wrapper.find('[data-testid="switcher-loading-state"]'); - const findToggleLoader = () => findDependenciesToggle().find(GlLoadingIcon); + const findToggleLoader = () => findDependenciesToggle().findComponent(GlLoadingIcon); const findHoverTip = () => wrapper.findComponent(GlAlert); - const findPipelineInsightsBtn = () => wrapper.find('[data-testid="pipeline-insights-btn"]'); const defaultProps = { showLinks: false, tipPreviouslyDismissed: false, type: STAGE_VIEW, - isPipelineComplete: true, }; const defaultData = { @@ -38,14 +27,6 @@ describe('the graph view selector component', () => { showLinksActive: false, }; - const getPerformanceInsightsHandler = jest - .fn() - .mockResolvedValue(mockPerformanceInsightsResponse); - - const requestHandlers = [[getPerformanceInsights, getPerformanceInsightsHandler]]; - - const apolloProvider = createMockApollo(requestHandlers); - const createComponent = ({ data = {}, mountFn = shallowMount, props = {} } = {}) => { wrapper = mountFn(GraphViewSelector, { propsData: { @@ -58,7 +39,6 @@ describe('the graph view selector component', () => { ...data, }; }, - apolloProvider, }); }; @@ -222,44 +202,5 @@ describe('the graph view selector component', () => { expect(findHoverTip().exists()).toBe(false); }); }); - - describe('pipeline insights', () => { - it.each` - isPipelineComplete | shouldShow - ${true} | ${true} - ${false} | ${false} - `( - 'button should display $shouldShow if isPipelineComplete is $isPipelineComplete ', - ({ isPipelineComplete, shouldShow }) => { - createComponent({ - props: { - isPipelineComplete, - }, - }); - - expect(findPipelineInsightsBtn().exists()).toBe(shouldShow); - }, - ); - }); - - describe('tracking', () => { - beforeEach(() => { - createComponent(); - - trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn); - }); - - afterEach(() => { - unmockTracking(); - }); - - it('tracks performance insights button click', () => { - findPipelineInsightsBtn().vm.$emit('click'); - - expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_insights_button', { - label: 'performance_insights', - }); - }); - }); }); }); |