MCPcopy Create free account
hub / github.com/algolia/cli / TestTrack_MergesCustomProperties

Function TestTrack_MergesCustomProperties

pkg/telemetry/telemetry_test.go:200–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func TestTrack_MergesCustomProperties(t *testing.T) {
201 fake := &fakeAnalyticsClient{}
202 client := &AnalyticsTelemetryClient{client: fake}
203
204 metadata := NewEventMetadata()
205 metadata.SetAppID("app-id")
206 ctx := WithEventMetadata(context.Background(), metadata)
207
208 require.NoError(t, client.Track(ctx, "CLI Auth Started", map[string]any{"flow": "login"}))
209 require.Len(t, fake.messages, 1)
210
211 track, ok := fake.messages[0].(analytics.Track)
212 require.True(t, ok)
213 assert.Equal(t, "login", track.Properties["flow"])
214 assert.Equal(t, metadata.InvocationID, track.Properties["invocation_id"])
215 assert.Equal(t, "app-id", track.Properties["app_id"])
216}
217
218func TestTrack_SequenceIsMonotonic(t *testing.T) {
219 fake := &fakeAnalyticsClient{}

Callers

nothing calls this directly

Calls 4

TrackMethod · 0.95
NewEventMetadataFunction · 0.85
WithEventMetadataFunction · 0.85
SetAppIDMethod · 0.80

Tested by

no test coverage detected