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

Function TestTrack_CustomPropertiesCannotOverrideBase

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

Source from the content-addressed store, hash-verified

265}
266
267func TestTrack_CustomPropertiesCannotOverrideBase(t *testing.T) {
268 fake := &fakeAnalyticsClient{}
269 client := &AnalyticsTelemetryClient{client: fake}
270
271 metadata := NewEventMetadata()
272 ctx := WithEventMetadata(context.Background(), metadata)
273
274 require.NoError(t, client.Track(ctx, "Command Invoked", map[string]any{
275 "invocation_id": "spoofed",
276 "sequence": int64(999),
277 }))
278 require.Len(t, fake.messages, 1)
279
280 track, ok := fake.messages[0].(analytics.Track)
281 require.True(t, ok)
282 assert.Equal(t, metadata.InvocationID, track.Properties["invocation_id"])
283 assert.Equal(t, int64(1), track.Properties["sequence"])
284}

Callers

nothing calls this directly

Calls 3

TrackMethod · 0.95
NewEventMetadataFunction · 0.85
WithEventMetadataFunction · 0.85

Tested by

no test coverage detected