(t *testing.T)
| 154 | } |
| 155 | |
| 156 | func Test_newIOStreams_prompt(t *testing.T) { |
| 157 | tests := []struct { |
| 158 | name string |
| 159 | config gh.Config |
| 160 | promptDisabled bool |
| 161 | env map[string]string |
| 162 | }{ |
| 163 | { |
| 164 | name: "default config", |
| 165 | promptDisabled: false, |
| 166 | }, |
| 167 | { |
| 168 | name: "config with prompt disabled", |
| 169 | config: disablePromptConfig(), |
| 170 | promptDisabled: true, |
| 171 | }, |
| 172 | { |
| 173 | name: "prompt disabled via GH_PROMPT_DISABLED env var", |
| 174 | env: map[string]string{"GH_PROMPT_DISABLED": "1"}, |
| 175 | promptDisabled: true, |
| 176 | }, |
| 177 | } |
| 178 | for _, tt := range tests { |
| 179 | t.Run(tt.name, func(t *testing.T) { |
| 180 | if tt.env != nil { |
| 181 | for k, v := range tt.env { |
| 182 | t.Setenv(k, v) |
| 183 | } |
| 184 | } |
| 185 | var cfg gh.Config |
| 186 | if tt.config != nil { |
| 187 | cfg = tt.config |
| 188 | } else { |
| 189 | cfg = config.NewMockConfig() |
| 190 | } |
| 191 | io := newIOStreams(cfg, "") |
| 192 | assert.Equal(t, tt.promptDisabled, io.GetNeverPrompt()) |
| 193 | }) |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | func Test_newIOStreams_spinnerDisabled(t *testing.T) { |
| 198 | tests := []struct { |
nothing calls this directly
no test coverage detected