MCPcopy Create free account
hub / github.com/cli/cli / TestGetOrDefaultExistingTopLevelKey

Function TestGetOrDefaultExistingTopLevelKey

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

Source from the content-addressed store, hash-verified

89}
90
91func TestGetOrDefaultExistingTopLevelKey(t *testing.T) {
92 // Given have a top level config entry
93 cfg := newTestConfig()
94 cfg.Set("", "top-level-key", "top-level-value")
95
96 // When we get that key
97 optionalEntry := cfg.GetOrDefault("non-existent-host", "top-level-key")
98
99 // Then it returns a Some variant containing the correct value and a source of user
100 entry := optionalEntry.Expect("expected there to be a value")
101 require.Equal(t, "top-level-value", entry.Value)
102 require.Equal(t, gh.ConfigUserProvided, entry.Source)
103}
104
105func TestGetOrDefaultExistingHostSpecificKey(t *testing.T) {
106 // Given have a host specific config entry

Callers

nothing calls this directly

Calls 5

newTestConfigFunction · 0.85
ExpectMethod · 0.80
EqualMethod · 0.80
SetMethod · 0.65
GetOrDefaultMethod · 0.65

Tested by

no test coverage detected