@@ -688,3 +688,111 @@ func TestSearchOptions_Marshal(t *testing.T) {
688688
689689 testJSONMarshal (t , u , want )
690690}
691+
692+ func TestIssuesSearchResult_Marshal (t * testing.T ) {
693+ testJSONMarshal (t , & IssuesSearchResult {}, "{}" )
694+
695+ u := & IssuesSearchResult {
696+ Total : Int (48 ),
697+ IncompleteResults : Bool (false ),
698+ Issues : []* Issue {
699+ {
700+ ID : Int64 (1 ),
701+ Number : Int (1 ),
702+ State : String ("s" ),
703+ Locked : Bool (false ),
704+ Title : String ("title" ),
705+ Body : String ("body" ),
706+ AuthorAssociation : String ("aa" ),
707+ User : & User {ID : Int64 (1 )},
708+ Labels : []* Label {{ID : Int64 (1 )}},
709+ Assignee : & User {ID : Int64 (1 )},
710+ Comments : Int (1 ),
711+ ClosedAt : & referenceTime ,
712+ CreatedAt : & referenceTime ,
713+ UpdatedAt : & referenceTime ,
714+ ClosedBy : & User {ID : Int64 (1 )},
715+ URL : String ("url" ),
716+ HTMLURL : String ("hurl" ),
717+ CommentsURL : String ("curl" ),
718+ EventsURL : String ("eurl" ),
719+ LabelsURL : String ("lurl" ),
720+ RepositoryURL : String ("rurl" ),
721+ Milestone : & Milestone {ID : Int64 (1 )},
722+ PullRequestLinks : & PullRequestLinks {URL : String ("url" )},
723+ Repository : & Repository {ID : Int64 (1 )},
724+ Reactions : & Reactions {TotalCount : Int (1 )},
725+ Assignees : []* User {{ID : Int64 (1 )}},
726+ NodeID : String ("nid" ),
727+ TextMatches : []* TextMatch {{ObjectURL : String ("ourl" )}},
728+ ActiveLockReason : String ("alr" ),
729+ },
730+ },
731+ }
732+
733+ want := `{
734+ "total_count": 48,
735+ "incomplete_results": false,
736+ "items": [
737+ {
738+ "id": 1,
739+ "number": 1,
740+ "state": "s",
741+ "locked": false,
742+ "title": "title",
743+ "body": "body",
744+ "author_association": "aa",
745+ "user": {
746+ "id": 1
747+ },
748+ "labels": [
749+ {
750+ "id": 1
751+ }
752+ ],
753+ "assignee": {
754+ "id": 1
755+ },
756+ "comments": 1,
757+ "closed_at": ` + referenceTimeStr + `,
758+ "created_at": ` + referenceTimeStr + `,
759+ "updated_at": ` + referenceTimeStr + `,
760+ "closed_by": {
761+ "id": 1
762+ },
763+ "url": "url",
764+ "html_url": "hurl",
765+ "comments_url": "curl",
766+ "events_url": "eurl",
767+ "labels_url": "lurl",
768+ "repository_url": "rurl",
769+ "milestone": {
770+ "id": 1
771+ },
772+ "pull_request": {
773+ "url": "url"
774+ },
775+ "repository": {
776+ "id": 1
777+ },
778+ "reactions": {
779+ "total_count": 1
780+ },
781+ "assignees": [
782+ {
783+ "id": 1
784+ }
785+ ],
786+ "node_id": "nid",
787+ "text_matches": [
788+ {
789+ "object_url": "ourl"
790+ }
791+ ],
792+ "active_lock_reason": "alr"
793+ }
794+ ]
795+ }`
796+
797+ testJSONMarshal (t , u , want )
798+ }
0 commit comments