(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func TestReactionsService_CreateCommentReaction(t *testing.T) { |
| 108 | t.Parallel() |
| 109 | client, mux, _ := setup(t) |
| 110 | |
| 111 | mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { |
| 112 | testMethod(t, r, "POST") |
| 113 | testHeader(t, r, "Accept", mediaTypeReactionsPreview) |
| 114 | |
| 115 | w.WriteHeader(http.StatusCreated) |
| 116 | assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) |
| 117 | }) |
| 118 | |
| 119 | ctx := t.Context() |
| 120 | got, _, err := client.Reactions.CreateCommentReaction(ctx, "o", "r", 1, "+1") |
| 121 | if err != nil { |
| 122 | t.Errorf("CreateCommentReaction returned error: %v", err) |
| 123 | } |
| 124 | want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} |
| 125 | if !cmp.Equal(got, want) { |
| 126 | t.Errorf("CreateCommentReaction = %+v, want %+v", got, want) |
| 127 | } |
| 128 | |
| 129 | const methodName = "CreateCommentReaction" |
| 130 | testBadOptions(t, methodName, func() (err error) { |
| 131 | _, _, err = client.Reactions.CreateCommentReaction(ctx, "\n", "\n", -1, "\n") |
| 132 | return err |
| 133 | }) |
| 134 | |
| 135 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 136 | got, resp, err := client.Reactions.CreateCommentReaction(ctx, "o", "r", 1, "+1") |
| 137 | if got != nil { |
| 138 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 139 | } |
| 140 | return resp, err |
| 141 | }) |
| 142 | } |
| 143 | |
| 144 | func TestReactionsService_ListIssueReactions(t *testing.T) { |
| 145 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…