(t *testing.T)
| 235 | } |
| 236 | |
| 237 | func Test_newIOStreams_prompt(t *testing.T) { |
| 238 | tests := []struct { |
| 239 | name string |
| 240 | config gh.Config |
| 241 | promptDisabled bool |
| 242 | env map[string]string |
| 243 | }{ |
| 244 | { |
| 245 | name: "default config", |
| 246 | promptDisabled: false, |
| 247 | }, |
| 248 | { |
| 249 | name: "config with prompt disabled", |
| 250 | config: disablePromptConfig(), |
| 251 | promptDisabled: true, |
| 252 | }, |
| 253 | { |
| 254 | name: "prompt disabled via GH_PROMPT_DISABLED env var", |
| 255 | env: map[string]string{"GH_PROMPT_DISABLED": "1"}, |
| 256 | promptDisabled: true, |
| 257 | }, |
| 258 | } |
| 259 | for _, tt := range tests { |
| 260 | t.Run(tt.name, func(t *testing.T) { |
| 261 | if tt.env != nil { |
| 262 | for k, v := range tt.env { |
| 263 | t.Setenv(k, v) |
| 264 | } |
| 265 | } |
| 266 | var cfg gh.Config |
| 267 | if tt.config != nil { |
| 268 | cfg = tt.config |
| 269 | } else { |
| 270 | cfg = config.NewMockConfig() |
| 271 | } |
| 272 | io := newIOStreams(cfg, "") |
| 273 | assert.Equal(t, tt.promptDisabled, io.GetNeverPrompt()) |
| 274 | }) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | func Test_newIOStreams_spinnerDisabled(t *testing.T) { |
| 279 | tests := []struct { |
nothing calls this directly
no test coverage detected