@@ -66,3 +66,79 @@ func TestGetConfig(t *testing.T) {
66
66
return resp , err
67
67
})
68
68
}
69
+
70
+ func TestAppConfig_Marshal (t * testing.T ) {
71
+ testJSONMarshal (t , & AppConfig {}, "{}" )
72
+
73
+ u := & AppConfig {
74
+ ID : Int64 (1 ),
75
+ NodeID : String ("nid" ),
76
+ Owner : & User {
77
+ Login : String ("l" ),
78
+ ID : Int64 (1 ),
79
+ URL : String ("u" ),
80
+ AvatarURL : String ("a" ),
81
+ GravatarID : String ("g" ),
82
+ Name : String ("n" ),
83
+ Company : String ("c" ),
84
+ Blog : String ("b" ),
85
+ Location : String ("l" ),
86
+ Email : String ("e" ),
87
+ Hireable : Bool (true ),
88
+ Bio : String ("b" ),
89
+ TwitterUsername : String ("t" ),
90
+ PublicRepos : Int (1 ),
91
+ Followers : Int (1 ),
92
+ Following : Int (1 ),
93
+ CreatedAt : & Timestamp {referenceTime },
94
+ SuspendedAt : & Timestamp {referenceTime },
95
+ },
96
+ Name : String ("n" ),
97
+ Description : String ("d" ),
98
+ ExternalURL : String ("eu" ),
99
+ HTMLURL : String ("hu" ),
100
+ CreatedAt : & Timestamp {referenceTime },
101
+ UpdatedAt : & Timestamp {referenceTime },
102
+ ClientID : String ("ci" ),
103
+ ClientSecret : String ("cs" ),
104
+ WebhookSecret : String ("ws" ),
105
+ PEM : String ("pem" ),
106
+ }
107
+
108
+ want := `{
109
+ "id": 1,
110
+ "node_id": "nid",
111
+ "owner": {
112
+ "login": "l",
113
+ "id": 1,
114
+ "avatar_url": "a",
115
+ "gravatar_id": "g",
116
+ "name": "n",
117
+ "company": "c",
118
+ "blog": "b",
119
+ "location": "l",
120
+ "email": "e",
121
+ "hireable": true,
122
+ "bio": "b",
123
+ "twitter_username": "t",
124
+ "public_repos": 1,
125
+ "followers": 1,
126
+ "following": 1,
127
+ "created_at": ` + referenceTimeStr + `,
128
+ "suspended_at": ` + referenceTimeStr + `,
129
+ "url": "u"
130
+ },
131
+ "name": "n",
132
+ "description": "d",
133
+ "external_url": "eu",
134
+ "html_url": "hu",
135
+ "created_at": ` + referenceTimeStr + `,
136
+ "updated_at": ` + referenceTimeStr + `,
137
+ "client_id": "ci",
138
+ "client_secret": "cs",
139
+ "webhook_secret": "ws",
140
+ "pem": "pem"
141
+ }`
142
+
143
+ testJSONMarshal (t , u , want )
144
+ }
0 commit comments