@@ -868,3 +868,41 @@ func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t
868
868
return client .Reactions .DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID (ctx , 1 , 2 , 3 , 4 , 5 )
869
869
})
870
870
}
871
+
872
+ func TestReactionService_CreateReleaseReaction (t * testing.T ) {
873
+ client , mux , _ , teardown := setup ()
874
+ defer teardown ()
875
+
876
+ mux .HandleFunc ("/repos/o/r/releases/1/reactions" , func (w http.ResponseWriter , r * http.Request ) {
877
+ testMethod (t , r , "POST" )
878
+ testHeader (t , r , "Accept" , mediaTypeReactionsPreview )
879
+
880
+ w .WriteHeader (http .StatusCreated )
881
+ w .Write ([]byte (`{"id":1,"user":{"login":"l","id":2},"content":"rocket"}` ))
882
+ })
883
+
884
+ const methodName = "CreateReleaseReaction"
885
+ ctx := context .Background ()
886
+ got , _ , err := client .Reactions .CreateReleaseReaction (ctx , "o" , "r" , 1 , "rocket" )
887
+ if err != nil {
888
+ t .Errorf ("%v returned error: %v" , methodName , err )
889
+ }
890
+
891
+ want := & Reaction {ID : Int64 (1 ), User : & User {Login : String ("l" ), ID : Int64 (2 )}, Content : String ("rocket" )}
892
+ if ! cmp .Equal (got , want ) {
893
+ t .Errorf ("%v = %+v, want %+v" , methodName , got , want )
894
+ }
895
+
896
+ testBadOptions (t , methodName , func () (err error ) {
897
+ _ , _ , err = client .Reactions .CreateReleaseReaction (ctx , "\n " , "\n " , - 1 , "\n " )
898
+ return err
899
+ })
900
+
901
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
902
+ got , resp , err := client .Reactions .CreateReleaseReaction (ctx , "o" , "r" , 1 , "rocket" )
903
+ if got != nil {
904
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
905
+ }
906
+ return resp , err
907
+ })
908
+ }
0 commit comments