@@ -123,11 +123,34 @@ describe('AnalyticsService', () => {
123
123
nonTracking : true ,
124
124
} ) ;
125
125
126
+ expect ( mockAnalyticsTrack ) . toHaveBeenCalledWith ( {
127
+ anonymousId : NON_TRACKING_ANONYMOUS_ID ,
128
+ integrations : { Amplitude : { session_id : sessionId } } ,
129
+ event : TelemetryEvents . ApplicationStarted ,
130
+ properties : {
131
+ anonymousId : mockAnonymousId ,
132
+ buildType : AppType . Electron ,
133
+ controlNumber : mockControlNumber ,
134
+ controlGroup : mockControlGroup ,
135
+ appVersion : mockAppVersion ,
136
+ } ,
137
+ } ) ;
138
+ } ) ;
139
+ it ( 'should send event for non tracking with regular payload' , async ( ) => {
140
+ settingsService . getAppSettings . mockResolvedValue ( mockAppSettings ) ;
141
+
142
+ await service . sendEvent ( {
143
+ event : TelemetryEvents . ApplicationStarted ,
144
+ eventData : { } ,
145
+ nonTracking : true ,
146
+ } ) ;
147
+
126
148
expect ( mockAnalyticsTrack ) . toHaveBeenCalledWith ( {
127
149
anonymousId : mockAnonymousId ,
128
150
integrations : { Amplitude : { session_id : sessionId } } ,
129
151
event : TelemetryEvents . ApplicationStarted ,
130
152
properties : {
153
+ anonymousId : undefined ,
131
154
buildType : AppType . Electron ,
132
155
controlNumber : mockControlNumber ,
133
156
controlGroup : mockControlGroup ,
@@ -190,11 +213,34 @@ describe('AnalyticsService', () => {
190
213
nonTracking : true ,
191
214
} ) ;
192
215
216
+ expect ( mockAnalyticsPage ) . toHaveBeenCalledWith ( {
217
+ anonymousId : NON_TRACKING_ANONYMOUS_ID ,
218
+ integrations : { Amplitude : { session_id : sessionId } } ,
219
+ name : TelemetryEvents . ApplicationStarted ,
220
+ properties : {
221
+ anonymousId : mockAnonymousId ,
222
+ buildType : AppType . Electron ,
223
+ controlNumber : mockControlNumber ,
224
+ controlGroup : mockControlGroup ,
225
+ appVersion : mockAppVersion ,
226
+ } ,
227
+ } ) ;
228
+ } ) ;
229
+ it ( 'should send page for non tracking events with regular payload' , async ( ) => {
230
+ settingsService . getAppSettings . mockResolvedValue ( mockAppSettings ) ;
231
+
232
+ await service . sendPage ( {
233
+ event : TelemetryEvents . ApplicationStarted ,
234
+ eventData : { } ,
235
+ nonTracking : true ,
236
+ } ) ;
237
+
193
238
expect ( mockAnalyticsPage ) . toHaveBeenCalledWith ( {
194
239
anonymousId : mockAnonymousId ,
195
240
integrations : { Amplitude : { session_id : sessionId } } ,
196
241
name : TelemetryEvents . ApplicationStarted ,
197
242
properties : {
243
+ anonymousId : undefined ,
198
244
buildType : AppType . Electron ,
199
245
controlNumber : mockControlNumber ,
200
246
controlGroup : mockControlGroup ,
0 commit comments