Skip to content

Commit

Permalink
Add test for JSON marshaling for Reaction and Reactions - relates to (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslanghorst authored and gmlewis committed Oct 29, 2019
1 parent 126ad63 commit e9c3f88
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions github/reactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,53 @@ import (
"testing"
)

func TestReaction_Marshal(t *testing.T) {
testJSONMarshal(t, &Reaction{}, "{}")

r := &Reaction{
ID: Int64(1),
User: nil,
NodeID: String("n"),
Content: String("+1"),
}

want := `{
"id": 1,
"node_id": "n",
"content": "+1"
}`

testJSONMarshal(t, r, want)
}

func TestReactions_Marshal(t *testing.T) {
testJSONMarshal(t, &Reactions{}, "{}")

r := &Reactions{
TotalCount: Int(1),
PlusOne: Int(1),
MinusOne: Int(1),
Laugh: Int(1),
Confused: Int(1),
Heart: Int(1),
Hooray: Int(1),
URL: String("u"),
}

want := `{
"total_count": 1,
"+1": 1,
"-1": 1,
"laugh": 1,
"confused": 1,
"heart": 1,
"hooray": 1,
"url": "u"
}`

testJSONMarshal(t, r, want)
}

func TestReactionsService_ListCommentReactions(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
Expand Down

0 comments on commit e9c3f88

Please sign in to comment.