Skip to content

Commit

Permalink
Add test case for JSON ExternalGroup marshaling - teams_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
rahukarmore committed Oct 28, 2022
1 parent f550bc8 commit 2f10a9a
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions github/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2154,3 +2154,57 @@ func TestExternalGroupMember_Marshal(t *testing.T) {

testJSONMarshal(t, u, want)
}

func TestExternalGroup_Marshal(t *testing.T) {
testJSONMarshal(t, &ExternalGroup{}, "{}")

u := &ExternalGroup{
GroupID: Int64(123),
GroupName: String("group1"),
UpdatedAt: &Timestamp{referenceTime},
Teams: []*ExternalGroupTeam{
{
TeamID: Int64(1),
TeamName: String("team-test"),
},
{
TeamID: Int64(2),
TeamName: String("team-test2"),
},
},
Members: []*ExternalGroupMember{
{
MemberID: Int64(1),
MemberLogin: String("test"),
MemberName: String("test"),
MemberEmail: String("[email protected]"),
},
},
}

want := `{
"group_id": 123,
"group_name": "group1",
"updated_at": ` + referenceTimeStr + `,
"teams": [
{
"team_id": 1,
"team_name": "team-test"
},
{
"team_id": 2,
"team_name": "team-test2"
}
],
"members": [
{
"member_id": 1,
"member_login": "test",
"member_name": "test",
"member_email": "[email protected]"
}
]
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 2f10a9a

Please sign in to comment.