Skip to content

Commit 19111bc

Browse files
palash25willnorris
authored andcommitted
projects_test.go: Add TestProject_marshall function
Related to: #55
1 parent dcd9d6d commit 19111bc

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

‎github/projects_test.go‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,73 @@ import (
1515
"testing"
1616
)
1717

18+
func TestProject_marshall(t *testing.T) {
19+
testJSONMarshal(t, &Project{}, "{}")
20+
21+
u := &Project{
22+
ID: Int64(1),
23+
URL: String("u"),
24+
HTMLURL: String("h"),
25+
ColumnsURL: String("c"),
26+
OwnerURL: String("o"),
27+
Name: String("n"),
28+
Body: String("b"),
29+
Number: Int(1),
30+
State: String("s"),
31+
CreatedAt: &Timestamp{referenceTime},
32+
UpdatedAt: &Timestamp{referenceTime},
33+
NodeID: String("n"),
34+
Creator: &User{
35+
Login: String("l"),
36+
ID: Int64(1),
37+
AvatarURL: String("a"),
38+
GravatarID: String("g"),
39+
Name: String("n"),
40+
Company: String("c"),
41+
Blog: String("b"),
42+
Location: String("l"),
43+
Email: String("e"),
44+
Hireable: Bool(true),
45+
PublicRepos: Int(1),
46+
Followers: Int(1),
47+
Following: Int(1),
48+
CreatedAt: &Timestamp{referenceTime},
49+
URL: String("u"),
50+
},
51+
}
52+
want := `{
53+
"id": 1,
54+
"url": "u",
55+
"html_url": "h",
56+
"columns_url": "c",
57+
"owner_url": "o",
58+
"name": "n",
59+
"body": "b",
60+
"number": 1,
61+
"state": "s",
62+
"created_at": ` + referenceTimeStr + `,
63+
"updated_at": ` + referenceTimeStr + `,
64+
"node_id": "n",
65+
"creator": {
66+
"login": "l",
67+
"id": 1,
68+
"avatar_url": "a",
69+
"gravatar_id": "g",
70+
"name": "n",
71+
"company": "c",
72+
"blog": "b",
73+
"location": "l",
74+
"email": "e",
75+
"hireable": true,
76+
"public_repos": 1,
77+
"followers": 1,
78+
"following": 1,
79+
"created_at": ` + referenceTimeStr + `,
80+
"url": "u"
81+
}
82+
}`
83+
testJSONMarshal(t, u, want)
84+
}
1885
func TestProjectsService_UpdateProject(t *testing.T) {
1986
client, mux, _, teardown := setup()
2087
defer teardown()

0 commit comments

Comments
 (0)