Skip to content

Commit

Permalink
Add test case for JSON resource marshaling (#2545)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulkarmore committed Oct 29, 2022
1 parent 9473fc9 commit 43edea6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions github/search_test.go
Expand Up @@ -953,3 +953,39 @@ func TestCommitResult_Marshal(t *testing.T) {

testJSONMarshal(t, c, want)
}

func TestUsersSearchResult_Marshal(t *testing.T) {
testJSONMarshal(t, &UsersSearchResult{}, "{}")

u := &UsersSearchResult{
Total: Int(2),
IncompleteResults: Bool(false),
Users: []*User{{
Login: String("loginTest"),
ID: Int64(1),
NodeID: String("NodeTest"),
AvatarURL: String("AvatarURLTest"),
HTMLURL: String("Hurl"),
GravatarID: String("gravatarIDTest"),
Name: String("nameTest"),
}},
}

want := `{
"total_count": 2,
"incomplete_results": false,
"items": [
{
"login": "loginTest",
"id": 1,
"node_id": "NodeTest",
"avatar_url": "AvatarURLTest",
"html_url": "Hurl",
"gravatar_id": "gravatarIDTest",
"name": "nameTest"
}
]
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 43edea6

Please sign in to comment.