Commit 4746cc37 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'jnnkl-update-license-compliance-tracking-event' into 'master'

Added tracking counter to mr_license_compliance_widget

See merge request gitlab-org/gitlab!77512
parents 1827fbf6 dbe8e684
<script>
import { GlLink, GlIcon, GlButton } from '@gitlab/ui';
import { mapState, mapGetters, mapActions } from 'vuex';
import { GlLink, GlIcon, GlButton } from '@gitlab/ui';
import api from '~/api';
import { componentNames, iconComponentNames } from 'ee/reports/components/issue_body';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
......@@ -114,6 +114,7 @@ export default {
methods: {
trackVisitedPath(trackAction) {
api.trackRedisHllUserEvent(trackAction);
api.trackRedisCounterEvent(trackAction);
},
...mapActions(LICENSE_MANAGEMENT, [
'setAPISettings',
......
......@@ -118,22 +118,30 @@ describe('License Report MR Widget', () => {
});
describe('snowplow', () => {
let trackEventSpy;
let trackUserEventSpy;
let trackCounterEventSpy;
beforeEach(() => {
mountComponent();
trackEventSpy = jest.spyOn(api, 'trackRedisHllUserEvent').mockImplementation(() => {});
trackUserEventSpy = jest.spyOn(api, 'trackRedisHllUserEvent').mockImplementation(() => {});
trackCounterEventSpy = jest
.spyOn(api, 'trackRedisCounterEvent')
.mockImplementation(() => {});
});
afterEach(() => {
trackEventSpy.mockRestore();
trackUserEventSpy.mockRestore();
trackCounterEventSpy.mockRestore();
});
it('tracks users_visiting_testing_license_compliance_full_report', () => {
wrapper.find('[data-testid="full-report-button"]').vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(
expect(trackUserEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_license_compliance_full_report',
);
expect(trackCounterEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_license_compliance_full_report',
);
});
......@@ -141,7 +149,11 @@ describe('License Report MR Widget', () => {
it('tracks users_visiting_testing_manage_license_compliance', () => {
wrapper.find('[data-testid="manage-licenses-button"]').vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(
expect(trackUserEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_manage_license_compliance',
);
expect(trackCounterEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_manage_license_compliance',
);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment