Skip to content

Commit

Permalink
Resource Tested for JSON marshalling : Stargazer
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar23sj committed Jun 24, 2021
1 parent e9c70da commit 325ab0f
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions github/activity_star_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,57 @@ func TestStarredRepository_Marshal(t *testing.T) {

testJSONMarshal(t, u, want)
}

func TestStargazer_Marshal(t *testing.T) {
testJSONMarshal(t, &Stargazer{}, "{}")

u := &Stargazer{
StarredAt: &Timestamp{referenceTime},
User: &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},
},
}

want := `{
"starred_at": ` + referenceTimeStr + `,
"user": {
"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"
}
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 325ab0f

Please sign in to comment.