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

Function TestReactionsService_ListIssueReactions

github/reactions_test.go:144–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestReactionsService_ListIssueReactions(t *testing.T) {
145 t.Parallel()
146 client, mux, _ := setup(t)
147
148 mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) {
149 testMethod(t, r, "GET")
150 testHeader(t, r, "Accept", mediaTypeReactionsPreview)
151 testFormValues(t, r, values{"content": "+1"})
152
153 w.WriteHeader(http.StatusOK)
154 assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
155 })
156
157 opt := &ListReactionOptions{Content: "+1"}
158 ctx := t.Context()
159 got, _, err := client.Reactions.ListIssueReactions(ctx, "o", "r", 1, opt)
160 if err != nil {
161 t.Errorf("ListIssueReactions returned error: %v", err)
162 }
163 want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}}
164 if !cmp.Equal(got, want) {
165 t.Errorf("ListIssueReactions = %+v, want %+v", got, want)
166 }
167}
168
169func TestReactionsService_ListIssueReactions_coverage(t *testing.T) {
170 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testHeaderFunction · 0.85
testFormValuesFunction · 0.85
assertWriteFunction · 0.85
ListIssueReactionsMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…