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