@@ -56,6 +56,23 @@ func TestGitService_GetRef_singleRef(t *testing.T) {
56
56
}
57
57
}
58
58
59
+ func TestGitService_GetRef_noRefs (t * testing.T ) {
60
+ client , mux , _ , teardown := setup ()
61
+ defer teardown ()
62
+
63
+ mux .HandleFunc ("/repos/o/r/git/refs/heads/b" , func (w http.ResponseWriter , r * http.Request ) {
64
+ testMethod (t , r , "GET" )
65
+ w .WriteHeader (http .StatusNotFound )
66
+ fmt .Fprint (w , "[]" )
67
+ })
68
+
69
+ _ , _ , err := client .Git .GetRef (context .Background (), "o" , "r" , "refs/heads/b" )
70
+ want := "no match found for this ref"
71
+ if err .Error () != want {
72
+ t .Errorf ("Git.GetRef returned %+v, want %+v" , err , want )
73
+ }
74
+ }
75
+
59
76
func TestGitService_GetRef_multipleRefs (t * testing.T ) {
60
77
client , mux , _ , teardown := setup ()
61
78
defer teardown ()
@@ -87,7 +104,7 @@ func TestGitService_GetRef_multipleRefs(t *testing.T) {
87
104
})
88
105
89
106
_ , _ , err := client .Git .GetRef (context .Background (), "o" , "r" , "refs/heads/b" )
90
- want := "no exact match found for this ref"
107
+ want := "multiple matches found for this ref"
91
108
if err .Error () != want {
92
109
t .Errorf ("Git.GetRef returned %+v, want %+v" , err , want )
93
110
}
0 commit comments