Skip to content

Commit

Permalink
Add test for resource JSON marshaling (#2533)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harikesh00 committed Oct 26, 2022
1 parent fc230a2 commit f659408
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions github/search_test.go
Expand Up @@ -876,3 +876,41 @@ func TestIssuesSearchResult_Marshal(t *testing.T) {

testJSONMarshal(t, u, want)
}

func TestLabelsSearchResult_Marshal(t *testing.T) {
testJSONMarshal(t, &LabelsSearchResult{}, "{}")

u := &LabelsSearchResult{
Total: Int(5),
IncompleteResults: Bool(false),
Labels: []*LabelResult{
{
ID: Int64(1),
URL: String("https://www.test-url.com"),
Name: String("test name"),
Color: String("green"),
Default: Bool(true),
Description: String("testDescription"),
Score: Float64(1),
},
},
}

want := `{
"total_count": 5,
"incomplete_results": false,
"items": [
{
"id": 1,
"url": "https://www.test-url.com",
"name": "test name",
"color": "green",
"default": true,
"description": "testDescription",
"score": 1
}
]
}`

testJSONMarshal(t, u, want)
}

0 comments on commit f659408

Please sign in to comment.