Skip to content

Commit

Permalink
Add test cases for JSON resource marshaling (#1994)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar23sj authored Jul 13, 2021
1 parent aad0285 commit 465df60
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions github/orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,45 @@ func TestOrganizationsService_ListInstallations_withListOptions(t *testing.T) {
return resp, err
})
}

func TestOrganizationInstallations_Marshal(t *testing.T) {
testJSONMarshal(t, &OrganizationInstallations{}, "{}")

o := &OrganizationInstallations{
TotalCount: Int(1),
Installations: []*Installation{{ID: Int64(1)}},
}
want := `{
"total_count": 1,
"installations": [
{
"id": 1
}
]
}`

testJSONMarshal(t, o, want)
}

func TestPlan_Marshal(t *testing.T) {
testJSONMarshal(t, &Plan{}, "{}")

o := &Plan{
Name: String("name"),
Space: Int(1),
Collaborators: Int(1),
PrivateRepos: Int(1),
FilledSeats: Int(1),
Seats: Int(1),
}
want := `{
"name": "name",
"space": 1,
"collaborators": 1,
"private_repos": 1,
"filled_seats": 1,
"seats": 1
}`

testJSONMarshal(t, o, want)
}

0 comments on commit 465df60

Please sign in to comment.