Skip to content

Commit f8641f0

Browse files
author
Artem
committed
fix tests
1 parent d8cec23 commit f8641f0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

redisinsight/api/src/modules/core/services/analytics/analytics.service.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
AnalyticsService,
77
NON_TRACKING_ANONYMOUS_ID,
88
} from './analytics.service';
9+
import { AppType } from 'src/modules/core/models/server-provider.interface';
910

1011
let mockAnalyticsTrack;
1112
jest.mock(
@@ -59,7 +60,7 @@ describe('AnalyticsService', () => {
5960

6061
describe('initialize', () => {
6162
it('should set anonymousId', () => {
62-
service.initialize({ anonymousId: mockAnonymousId, sessionId });
63+
service.initialize({ anonymousId: mockAnonymousId, sessionId, appType: AppType.Electron });
6364

6465
const anonymousId = service.getAnonymousId();
6566

@@ -70,7 +71,7 @@ describe('AnalyticsService', () => {
7071
describe('sendEvent', () => {
7172
beforeEach(() => {
7273
mockAnalyticsTrack = jest.fn();
73-
service.initialize({ anonymousId: mockAnonymousId, sessionId });
74+
service.initialize({ anonymousId: mockAnonymousId, sessionId, appType: AppType.Electron });
7475
});
7576
it('should send event with anonymousId if permission are granted', async () => {
7677
settingsService.getSettings = jest
@@ -87,7 +88,9 @@ describe('AnalyticsService', () => {
8788
anonymousId: mockAnonymousId,
8889
integrations: { Amplitude: { session_id: sessionId } },
8990
event: TelemetryEvents.ApplicationStarted,
90-
properties: {},
91+
properties: {
92+
buildType: AppType.Electron,
93+
},
9194
});
9295
});
9396
it('should not send event if permission are not granted', async () => {
@@ -118,7 +121,9 @@ describe('AnalyticsService', () => {
118121
anonymousId: mockAnonymousId,
119122
integrations: { Amplitude: { session_id: sessionId } },
120123
event: TelemetryEvents.ApplicationStarted,
121-
properties: {},
124+
properties: {
125+
buildType: AppType.Electron,
126+
},
122127
});
123128
});
124129
});

0 commit comments

Comments
 (0)