diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js')
-rw-r--r-- | spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js b/spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js index f4e6d43812d..ec2e833552a 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/details/package_history_spec.js @@ -17,6 +17,12 @@ import HistoryItem from '~/vue_shared/components/registry/history_item.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import waitForPromises from 'helpers/wait_for_promises'; import getPackagePipelines from '~/packages_and_registries/package_registry/graphql/queries/get_package_pipelines.query.graphql'; +import Tracking from '~/tracking'; +import { + TRACKING_ACTION_CLICK_PIPELINE_LINK, + TRACKING_ACTION_CLICK_COMMIT_LINK, + TRACKING_LABEL_PACKAGE_HISTORY, +} from '~/packages_and_registries/package_registry/constants'; Vue.use(VueApollo); @@ -181,7 +187,6 @@ describe('Package History', () => { it('link', () => { const linkElement = findElementLink(element); const exist = Boolean(link); - expect(linkElement.exists()).toBe(exist); if (exist) { expect(linkElement.attributes('href')).toBe(link); @@ -189,4 +194,29 @@ describe('Package History', () => { }); }, ); + describe('tracking', () => { + let eventSpy; + const category = 'UI::Packages'; + + beforeEach(() => { + mountComponent(); + eventSpy = jest.spyOn(Tracking, 'event'); + }); + + it('clicking pipeline link tracks the right action', () => { + wrapper.vm.trackPipelineClick(); + expect(eventSpy).toHaveBeenCalledWith(category, TRACKING_ACTION_CLICK_PIPELINE_LINK, { + category, + label: TRACKING_LABEL_PACKAGE_HISTORY, + }); + }); + + it('clicking commit link tracks the right action', () => { + wrapper.vm.trackCommitClick(); + expect(eventSpy).toHaveBeenCalledWith(category, TRACKING_ACTION_CLICK_COMMIT_LINK, { + category, + label: TRACKING_LABEL_PACKAGE_HISTORY, + }); + }); + }); }); |