MCPcopy Index your code
hub / github.com/cli/cli / TestTelemetry

Function TestTelemetry

internal/config/config_test.go:186–215  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestTelemetry(t *testing.T) {
187 t.Run("returns default when not configured", func(t *testing.T) {
188 c := newTestConfig()
189
190 entry := c.Telemetry()
191
192 require.Equal(t, "enabled", entry.Value)
193 require.Equal(t, gh.ConfigDefaultProvided, entry.Source)
194 })
195
196 t.Run("returns user configured value", func(t *testing.T) {
197 c := newTestConfig()
198 c.Set("", telemetryKey, "disabled")
199
200 entry := c.Telemetry()
201
202 require.Equal(t, "disabled", entry.Value)
203 require.Equal(t, gh.ConfigUserProvided, entry.Source)
204 })
205
206 t.Run("returns log when configured", func(t *testing.T) {
207 c := newTestConfig()
208 c.Set("", telemetryKey, "log")
209
210 entry := c.Telemetry()
211
212 require.Equal(t, "log", entry.Value)
213 require.Equal(t, gh.ConfigUserProvided, entry.Source)
214 })
215}

Callers

nothing calls this directly

Calls 5

newTestConfigFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
TelemetryMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected