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

Function TestTrackCommandCompleted_SkipsWhenPreRunNeverRan

pkg/cmd/root/root_test.go:49–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestTrackCommandCompleted_SkipsWhenPreRunNeverRan(t *testing.T) {
50 client := &recordingTelemetryClient{}
51 // An empty command path means PersistentPreRunE never ran.
52 ctx := newTelemetryContext(client, "")
53
54 trackCommandCompleted(ctx, &cobra.Command{Use: "algolia"}, exitOK, nil, time.Second)
55
56 if len(client.events) != 0 {
57 t.Errorf("expected no event, got %d", len(client.events))
58 }
59}
60
61func TestTrackCommandCompleted_ReportsSuccess(t *testing.T) {
62 client := &recordingTelemetryClient{}

Callers

nothing calls this directly

Calls 3

newTelemetryContextFunction · 0.85
trackCommandCompletedFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected