diff --git a/pkg/cmd/auth/shared/gitcredentials/helper_config_test.go b/pkg/cmd/auth/shared/gitcredentials/helper_config_test.go index acf5612ca..b7ddbb883 100644 --- a/pkg/cmd/auth/shared/gitcredentials/helper_config_test.go +++ b/pkg/cmd/auth/shared/gitcredentials/helper_config_test.go @@ -3,6 +3,7 @@ package gitcredentials_test import ( "context" "path/filepath" + "runtime" "testing" "github.com/cli/cli/v2/git" @@ -135,9 +136,10 @@ func TestConfiguredHelperWithPreexistingHostHelperConfigured(t *testing.T) { func TestHelperIsOurs(t *testing.T) { tests := []struct { - name string - cmd string - want bool + name string + cmd string + want bool + windowsOnly bool }{ { name: "blank", @@ -164,9 +166,19 @@ func TestHelperIsOurs(t *testing.T) { cmd: "!/path/to/gh auth", want: true, }, + { + name: "ours - Windows edition", + cmd: `!'C:\Program Files\GitHub CLI\gh.exe' auth git-credential`, + want: true, + windowsOnly: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + if tt.windowsOnly && runtime.GOOS != "windows" { + t.Skip("skipping test on non-Windows platform") + } + h := gitcredentials.Helper{Cmd: tt.cmd} if got := h.IsOurs(); got != tt.want { t.Errorf("IsOurs() = %v, want %v", got, tt.want)