(t *testing.T)
| 201 | } |
| 202 | |
| 203 | func TestRepositoriesService_UpdateComment(t *testing.T) { |
| 204 | t.Parallel() |
| 205 | client, mux, _ := setup(t) |
| 206 | |
| 207 | input := &RepositoryComment{Body: Ptr("b")} |
| 208 | |
| 209 | mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { |
| 210 | var v *RepositoryComment |
| 211 | assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) |
| 212 | |
| 213 | testMethod(t, r, "PATCH") |
| 214 | if !cmp.Equal(v, input) { |
| 215 | t.Errorf("Request body = %+v, want %+v", v, input) |
| 216 | } |
| 217 | |
| 218 | fmt.Fprint(w, `{"id":1}`) |
| 219 | }) |
| 220 | |
| 221 | ctx := t.Context() |
| 222 | comment, _, err := client.Repositories.UpdateComment(ctx, "o", "r", 1, input) |
| 223 | if err != nil { |
| 224 | t.Errorf("Repositories.UpdateComment returned error: %v", err) |
| 225 | } |
| 226 | |
| 227 | want := &RepositoryComment{ID: Ptr(int64(1))} |
| 228 | if !cmp.Equal(comment, want) { |
| 229 | t.Errorf("Repositories.UpdateComment returned %+v, want %+v", comment, want) |
| 230 | } |
| 231 | |
| 232 | const methodName = "UpdateComment" |
| 233 | testBadOptions(t, methodName, func() (err error) { |
| 234 | _, _, err = client.Repositories.UpdateComment(ctx, "\n", "\n", -1, input) |
| 235 | return err |
| 236 | }) |
| 237 | |
| 238 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 239 | got, resp, err := client.Repositories.UpdateComment(ctx, "o", "r", 1, input) |
| 240 | if got != nil { |
| 241 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 242 | } |
| 243 | return resp, err |
| 244 | }) |
| 245 | } |
| 246 | |
| 247 | func TestRepositoriesService_UpdateComment_invalidOwner(t *testing.T) { |
| 248 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…