Commit dbe8e684 authored by Jannik Lehmann's avatar Jannik Lehmann

Added tracking counter to mr_license_compliance_widget

parent 0b903b24
<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