From fa74e73a685e86ab76edab3809951cf7456ec547 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Sat, 10 Jul 2021 21:05:27 +0530 Subject: [PATCH 1/3] Resource Tested for JSON marshalling : FeedLink --- github/activity_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github/activity_test.go b/github/activity_test.go index 3d774279ecb..b22f0938c45 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -130,3 +130,19 @@ var wantFeeds = &Feeds{ }, }, } + +func TestFeedLink_Marshal(t *testing.T) { + testJSONMarshal(t, &FeedLink{}, "{}") + + u := &FeedLink{ + HRef: String("h"), + Type: String("t"), + } + + want := `{ + "href": "h", + "type": "t" + }` + + testJSONMarshal(t, u, want) +} From b0bda7a1c36f198bee9be060ba0c57dae37cc331 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Sat, 10 Jul 2021 21:06:52 +0530 Subject: [PATCH 2/3] Resource Tested for JSON marshalling : Feeds --- github/activity_test.go | 90 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/github/activity_test.go b/github/activity_test.go index b22f0938c45..a72d3a5be4f 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -146,3 +146,93 @@ func TestFeedLink_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestFeeds_Marshal(t *testing.T) { + testJSONMarshal(t, &Feeds{}, "{}") + + u := &Feeds{ + TimelineURL: String("t"), + UserURL: String("u"), + CurrentUserPublicURL: String("cupu"), + CurrentUserURL: String("cuu"), + CurrentUserActorURL: String("cuau"), + CurrentUserOrganizationURL: String("cuou"), + CurrentUserOrganizationURLs: []string{"a"}, + Links: &FeedLinks{ + Timeline: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + User: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserPublic: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUser: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserActor: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserOrganization: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserOrganizations: []*FeedLink{ + { + HRef: String("h"), + Type: String("t"), + }, + }, + }, + } + + want := `{ + "timeline_url": "t", + "user_url": "u", + "current_user_public_url": "cupu", + "current_user_url": "cuu", + "current_user_actor_url": "cuau", + "current_user_organization_url": "cuou", + "current_user_organization_urls": ["a"], + "_links": { + "timeline": { + "href": "h", + "type": "t" + }, + "user": { + "href": "h", + "type": "t" + }, + "current_user_public": { + "href": "h", + "type": "t" + }, + "current_user": { + "href": "h", + "type": "t" + }, + "current_user_actor": { + "href": "h", + "type": "t" + }, + "current_user_organization": { + "href": "h", + "type": "t" + }, + "current_user_organizations": [ + { + "href": "h", + "type": "t" + } + ] + } + }` + + testJSONMarshal(t, u, want) +} From 3b74056d27d00d2b5497269ebd8898e55f087503 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Sat, 10 Jul 2021 21:08:09 +0530 Subject: [PATCH 3/3] Resource Tested for JSON marshalling : FeedLinks --- github/activity_test.go | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/github/activity_test.go b/github/activity_test.go index a72d3a5be4f..ef7cf32fca5 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -236,3 +236,75 @@ func TestFeeds_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestFeedLinks_Marshal(t *testing.T) { + testJSONMarshal(t, &FeedLinks{}, "{}") + + u := &FeedLinks{ + Timeline: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + User: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserPublic: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUser: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserActor: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserOrganization: &FeedLink{ + HRef: String("h"), + Type: String("t"), + }, + CurrentUserOrganizations: []*FeedLink{ + { + HRef: String("h"), + Type: String("t"), + }, + }, + } + + want := `{ + "timeline": { + "href": "h", + "type": "t" + }, + "user": { + "href": "h", + "type": "t" + }, + "current_user_public": { + "href": "h", + "type": "t" + }, + "current_user": { + "href": "h", + "type": "t" + }, + "current_user_actor": { + "href": "h", + "type": "t" + }, + "current_user_organization": { + "href": "h", + "type": "t" + }, + "current_user_organizations": [ + { + "href": "h", + "type": "t" + } + ] + }` + + testJSONMarshal(t, u, want) +}