Skip to content

Commit

Permalink
Add test cases for JSON resource marshaling (#2550)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar23sj committed Oct 31, 2022
1 parent 434b1d8 commit 377f63f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions github/search_test.go
Expand Up @@ -989,3 +989,21 @@ func TestUsersSearchResult_Marshal(t *testing.T) {

testJSONMarshal(t, u, want)
}

func TestCodeSearchResult_Marshal(t *testing.T) {
testJSONMarshal(t, &CodeSearchResult{}, "{}")

u := &CodeSearchResult{
Total: Int(4),
IncompleteResults: Bool(false),
CodeResults: []*CodeResult{{Name: String("n")}},
}

want := `{
"total_count" : 4,
"incomplete_results" : false,
"items" : [{"name": "n"}]
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 377f63f

Please sign in to comment.