MCPcopy Create free account
hub / github.com/cli/cli / Test_newIOStreams_colorLabels

Function Test_newIOStreams_colorLabels

internal/ghcmd/cmd_test.go:450–524  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

448}
449
450func Test_newIOStreams_colorLabels(t *testing.T) {
451 tests := []struct {
452 name string
453 config gh.Config
454 colorLabelsEnabled bool
455 env map[string]string
456 }{
457 {
458 name: "default config",
459 colorLabelsEnabled: false,
460 },
461 {
462 name: "config with colorLabels enabled",
463 config: enableColorLabelsConfig(),
464 colorLabelsEnabled: true,
465 },
466 {
467 name: "config with colorLabels disabled",
468 config: disableColorLabelsConfig(),
469 colorLabelsEnabled: false,
470 },
471 {
472 name: "colorLabels enabled via `1` in GH_COLOR_LABELS env var",
473 env: map[string]string{"GH_COLOR_LABELS": "1"},
474 colorLabelsEnabled: true,
475 },
476 {
477 name: "colorLabels enabled via `true` in GH_COLOR_LABELS env var",
478 env: map[string]string{"GH_COLOR_LABELS": "true"},
479 colorLabelsEnabled: true,
480 },
481 {
482 name: "colorLabels enabled via `yes` in GH_COLOR_LABELS env var",
483 env: map[string]string{"GH_COLOR_LABELS": "yes"},
484 colorLabelsEnabled: true,
485 },
486 {
487 name: "colorLabels disable via empty string in GH_COLOR_LABELS env var",
488 env: map[string]string{"GH_COLOR_LABELS": ""},
489 colorLabelsEnabled: false,
490 },
491 {
492 name: "colorLabels disabled via `0` in GH_COLOR_LABELS env var",
493 env: map[string]string{"GH_COLOR_LABELS": "0"},
494 colorLabelsEnabled: false,
495 },
496 {
497 name: "colorLabels disabled via `false` in GH_COLOR_LABELS env var",
498 env: map[string]string{"GH_COLOR_LABELS": "false"},
499 colorLabelsEnabled: false,
500 },
501 {
502 name: "colorLabels disabled via `no` in GH_COLOR_LABELS env var",
503 env: map[string]string{"GH_COLOR_LABELS": "no"},
504 colorLabelsEnabled: false,
505 },
506 }
507 for _, tt := range tests {

Callers

nothing calls this directly

Calls 7

NewMockConfigFunction · 0.92
enableColorLabelsConfigFunction · 0.85
disableColorLabelsConfigFunction · 0.85
newIOStreamsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ColorLabelsMethod · 0.65

Tested by

no test coverage detected