(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestGetOrDefaultApplicationDefaults(t *testing.T) { |
| 39 | tests := []struct { |
| 40 | key string |
| 41 | expectedDefault string |
| 42 | }{ |
| 43 | {gitProtocolKey, "https"}, |
| 44 | {editorKey, ""}, |
| 45 | {promptKey, "enabled"}, |
| 46 | {pagerKey, ""}, |
| 47 | {httpUnixSocketKey, ""}, |
| 48 | {browserKey, ""}, |
| 49 | } |
| 50 | |
| 51 | for _, tt := range tests { |
| 52 | t.Run(tt.key, func(t *testing.T) { |
| 53 | // Given we have no top level configuration |
| 54 | cfg := newTestConfig() |
| 55 | |
| 56 | // When we get a key that has no value, but has a default |
| 57 | optionalEntry := cfg.GetOrDefault("", tt.key) |
| 58 | |
| 59 | // Then there is an entry with the default value, and source set as default |
| 60 | entry := optionalEntry.Expect(fmt.Sprintf("expected there to be a value for %s", tt.key)) |
| 61 | require.Equal(t, tt.expectedDefault, entry.Value) |
| 62 | require.Equal(t, gh.ConfigDefaultProvided, entry.Source) |
| 63 | }) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func TestGetOrDefaultNonExistentKey(t *testing.T) { |
| 68 | // Given we have no top level configuration |
nothing calls this directly
no test coverage detected