test(git): add parseRemoteBranches unit test

This commit is contained in:
2026-06-10 17:57:48 +08:00
parent a49d45a846
commit 3a1909f8f4
+23
View File
@@ -0,0 +1,23 @@
package git
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParseRemoteBranches(t *testing.T) {
t.Parallel()
input := []byte("aabbccdd\trefs/heads/main\n" +
"eeff0011\trefs/heads/develop\n" +
"22334455\trefs/heads/feature/foo\n" +
"deadbeef\trefs/tags/v1.0\n")
got := parseRemoteBranches(input)
require.Equal(t, []string{"main", "develop", "feature/foo"}, got)
}
func TestParseRemoteBranches_Empty(t *testing.T) {
t.Parallel()
got := parseRemoteBranches(nil)
require.Nil(t, got)
}