(t *testing.T)
| 223 | } |
| 224 | |
| 225 | func TestListRunDefaultHost(t *testing.T) { |
| 226 | ios, _, stdout, stderr := iostreams.Test() |
| 227 | cfg := config.NewMockConfig() |
| 228 | authCfg := cfg.Authentication() |
| 229 | authCfg.SetDefaultHost("example.com", "GH_HOST") |
| 230 | cfg.AuthenticationFunc = func() gh.AuthConfig { return authCfg } |
| 231 | clientErr := errors.New("event subscriptions are only supported on github.com") |
| 232 | var gotHost string |
| 233 | opts := &ListOptions{ |
| 234 | IO: ios, |
| 235 | Config: func() (gh.Config, error) { return cfg, nil }, |
| 236 | EventClient: func(host string) (client.EventClient, error) { |
| 237 | gotHost = host |
| 238 | return nil, clientErr |
| 239 | }, |
| 240 | Limit: 30, |
| 241 | } |
| 242 | |
| 243 | err := listRun(context.Background(), opts) |
| 244 | |
| 245 | require.ErrorIs(t, err, clientErr) |
| 246 | assert.Equal(t, "example.com", gotHost) |
| 247 | assert.Empty(t, stdout.String()) |
| 248 | assert.Empty(t, stderr.String()) |
| 249 | } |
nothing calls this directly
no test coverage detected