Skip to content

Commit

Permalink
Resource Tested for JSON marshalling : AppConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar23sj committed Jun 27, 2021
1 parent 05e95d3 commit fc5ad27
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions github/apps_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,79 @@ func TestGetConfig(t *testing.T) {
return resp, err
})
}

func TestAppConfig_Marshal(t *testing.T) {
testJSONMarshal(t, &AppConfig{}, "{}")

u := &AppConfig{
ID: Int64(1),
NodeID: String("nid"),
Owner: &User{
Login: String("l"),
ID: Int64(1),
URL: String("u"),
AvatarURL: String("a"),
GravatarID: String("g"),
Name: String("n"),
Company: String("c"),
Blog: String("b"),
Location: String("l"),
Email: String("e"),
Hireable: Bool(true),
Bio: String("b"),
TwitterUsername: String("t"),
PublicRepos: Int(1),
Followers: Int(1),
Following: Int(1),
CreatedAt: &Timestamp{referenceTime},
SuspendedAt: &Timestamp{referenceTime},
},
Name: String("n"),
Description: String("d"),
ExternalURL: String("eu"),
HTMLURL: String("hu"),
CreatedAt: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
ClientID: String("ci"),
ClientSecret: String("cs"),
WebhookSecret: String("ws"),
PEM: String("pem"),
}

want := `{
"id": 1,
"node_id": "nid",
"owner": {
"login": "l",
"id": 1,
"avatar_url": "a",
"gravatar_id": "g",
"name": "n",
"company": "c",
"blog": "b",
"location": "l",
"email": "e",
"hireable": true,
"bio": "b",
"twitter_username": "t",
"public_repos": 1,
"followers": 1,
"following": 1,
"created_at": ` + referenceTimeStr + `,
"suspended_at": ` + referenceTimeStr + `,
"url": "u"
},
"name": "n",
"description": "d",
"external_url": "eu",
"html_url": "hu",
"created_at": ` + referenceTimeStr + `,
"updated_at": ` + referenceTimeStr + `,
"client_id": "ci",
"client_secret": "cs",
"webhook_secret": "ws",
"pem": "pem"
}`

testJSONMarshal(t, u, want)
}

0 comments on commit fc5ad27

Please sign in to comment.