Commit 1827fbf6 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'jnnkl-update-telemetry-license-compliance-widget' into 'master'

Added tracking counter to mr_license_compliance_widget_body

See merge request gitlab-org/gitlab!77513
parents 0f226e87 400d9134
<script>
import { GlLink } from '@gitlab/ui';
import { mapActions } from 'vuex';
import { GlLink } from '@gitlab/ui';
import api from '~/api';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
......@@ -25,6 +25,7 @@ export default {
...mapActions(LICENSE_MANAGEMENT, ['setLicenseInModal']),
trackLinkClick() {
api.trackRedisHllUserEvent(LICENSE_LINK_TELEMETRY_EVENT);
api.trackRedisCounterEvent(LICENSE_LINK_TELEMETRY_EVENT);
},
},
};
......
......@@ -83,20 +83,24 @@ describe('LicenseIssueBody', () => {
});
describe('event tracking', () => {
let trackEventSpy;
let trackUserEventSpy;
let trackCounterEventSpy;
beforeEach(() => {
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', () => {
findGlLink().vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(LICENSE_LINK_TELEMETRY_EVENT);
expect(trackUserEventSpy).toHaveBeenCalledWith(LICENSE_LINK_TELEMETRY_EVENT);
expect(trackCounterEventSpy).toHaveBeenCalledWith(LICENSE_LINK_TELEMETRY_EVENT);
});
});
});
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