Skip to content

Commit 377f63f

Browse files
authored
Add test cases for JSON resource marshaling (#2550)
1 parent 434b1d8 commit 377f63f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

github/search_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,3 +989,21 @@ func TestUsersSearchResult_Marshal(t *testing.T) {
989989

990990
testJSONMarshal(t, u, want)
991991
}
992+
993+
func TestCodeSearchResult_Marshal(t *testing.T) {
994+
testJSONMarshal(t, &CodeSearchResult{}, "{}")
995+
996+
u := &CodeSearchResult{
997+
Total: Int(4),
998+
IncompleteResults: Bool(false),
999+
CodeResults: []*CodeResult{{Name: String("n")}},
1000+
}
1001+
1002+
want := `{
1003+
"total_count" : 4,
1004+
"incomplete_results" : false,
1005+
"items" : [{"name": "n"}]
1006+
}`
1007+
1008+
testJSONMarshal(t, u, want)
1009+
}

0 commit comments

Comments
 (0)