Skip to content

Commit 794a6c9

Browse files
author
sushmita wable
authored
Add test cases for JSON resource marshaling (#2191)
1 parent cbba2b0 commit 794a6c9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

github/search_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,3 +665,26 @@ func TestLabelResult_Marshal(t *testing.T) {
665665

666666
testJSONMarshal(t, u, want)
667667
}
668+
669+
func TestSearchOptions_Marshal(t *testing.T) {
670+
testJSONMarshal(t, &SearchOptions{}, "{}")
671+
672+
u := &SearchOptions{
673+
Sort: "author-date",
674+
Order: "asc",
675+
TextMatch: false,
676+
ListOptions: ListOptions{
677+
Page: int(1),
678+
PerPage: int(10),
679+
},
680+
}
681+
682+
want := `{
683+
"sort": "author-date",
684+
"order": "asc",
685+
"page": 1,
686+
"perPage": 10
687+
}`
688+
689+
testJSONMarshal(t, u, want)
690+
}

0 commit comments

Comments
 (0)