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

Function TestEventMetadataWithGet

pkg/telemetry/telemetry_test.go:54–70  ·  view source on GitHub ↗

Context-related tests.

(t *testing.T)

Source from the content-addressed store, hash-verified

52
53// Context-related tests.
54func TestEventMetadataWithGet(t *testing.T) {
55 ctx := context.Background()
56 event := &CLIAnalyticsEventMetadata{
57 UserID: "user-id",
58 InvocationID: "invocation-id",
59 OS: "os",
60 CLIVersion: "cli-version",
61 CommandPath: "command-path",
62 CommandFlags: []string{"flag1", "flag2"},
63 AppID: "app-id",
64 ConfiguredApplicationsNb: 1,
65 }
66 newCtx := WithEventMetadata(ctx, event)
67
68 // Check that the event is correctly set in the context.
69 require.Equal(t, event, GetEventMetadata(newCtx))
70}
71
72func TestEventMetadata_DoesNotExistsInContext(t *testing.T) {
73 ctx := context.Background()

Callers

nothing calls this directly

Calls 2

WithEventMetadataFunction · 0.85
GetEventMetadataFunction · 0.85

Tested by

no test coverage detected