MCPcopy Index your code
hub / github.com/google/go-github / TestGitService_ListMatchingRefs_noRefs

Function TestGitService_ListMatchingRefs_noRefs

github/git_refs_test.go:229–261  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

227}
228
229func TestGitService_ListMatchingRefs_noRefs(t *testing.T) {
230 t.Parallel()
231 client, mux, _ := setup(t)
232
233 mux.HandleFunc("/repos/o/r/git/matching-refs/heads/b", func(w http.ResponseWriter, r *http.Request) {
234 testMethod(t, r, "GET")
235 fmt.Fprint(w, "[]")
236 })
237
238 ctx := t.Context()
239 refs, _, err := client.Git.ListMatchingRefs(ctx, "o", "r", "heads/b")
240 if err != nil {
241 t.Errorf("Git.ListMatchingRefs returned error: %v", err)
242 }
243
244 if len(refs) != 0 {
245 t.Errorf("Git.ListMatchingRefs returned %+v, want an empty slice", refs)
246 }
247
248 const methodName = "ListMatchingRefs"
249 testBadOptions(t, methodName, func() (err error) {
250 _, _, err = client.Git.ListMatchingRefs(ctx, "\n", "\n", "")
251 return err
252 })
253
254 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
255 got, resp, err := client.Git.ListMatchingRefs(ctx, "o", "r", "")
256 if got != nil {
257 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
258 }
259 return resp, err
260 })
261}
262
263func TestGitService_ListMatchingRefs_allRefs(t *testing.T) {
264 t.Parallel()

Callers

nothing calls this directly

Calls 5

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
ListMatchingRefsMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…