mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 02:32:54 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
import { TestContext } from 'ember-test-helpers';
|
|
import { IBaseTrackingEvent } from '@datahub/shared/types/tracking/event-tracking';
|
|
import { TrackingEventCategory, TrackingGoal } from '@datahub/shared/constants/tracking/event-tracking';
|
|
import { getPiwikActivityQueue } from '@datahub/shared/utils/tracking/piwik';
|
|
import UnifiedTracking from '@datahub/shared/services/unified-tracking';
|
|
import Metrics from 'ember-metrics';
|
|
import MetricsServiceStub from '../../stubs/services/metrics';
|
|
|
|
module('Unit | Service | tracking', function(hooks): void {
|
|
setupTest(hooks);
|
|
|
|
hooks.beforeEach(function(this: TestContext) {
|
|
this.owner.register('service:metrics', MetricsServiceStub);
|
|
});
|
|
|
|
test('service exists and is registered', function(assert): void {
|
|
assert.ok(this.owner.lookup('service:unified-tracking'));
|
|
});
|
|
|
|
test('service methods proxy to metrics service and display expected behavior', function(assert): void {
|
|
assert.expect(2);
|
|
const trackingService: UnifiedTracking = this.owner.lookup('service:unified-tracking');
|
|
const metricsService: Metrics = this.owner.lookup('service:metrics');
|
|
const event: IBaseTrackingEvent = {
|
|
category: TrackingEventCategory.Entity,
|
|
action: ''
|
|
};
|
|
metricsService.trackEvent = (trackedEvent: IBaseTrackingEvent) =>
|
|
assert.deepEqual(
|
|
event,
|
|
trackedEvent,
|
|
'expected metrics service trackEvent method to be called by Tracking Service method'
|
|
);
|
|
|
|
trackingService.trackEvent(event);
|
|
|
|
const activityQueue = getPiwikActivityQueue(true);
|
|
trackingService.trackGoal({ name: TrackingGoal.SatClick });
|
|
|
|
assert.deepEqual(
|
|
activityQueue,
|
|
[['trackGoal', TrackingGoal.SatClick]],
|
|
'expected TrackingService#trackGoal to add "trackGoal" to activity queue'
|
|
);
|
|
});
|
|
});
|