From 61d513a0edf04843cda4c2a253cfc1bd95920796 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Thu, 24 Jun 2021 22:58:33 +0530 Subject: [PATCH] Resource Tested for JSON marshalling : Subscription --- github/activity_watching_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index c41205f4119..15b0f330783 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -257,3 +257,29 @@ func TestActivityService_DeleteRepositorySubscription(t *testing.T) { return client.Activity.DeleteRepositorySubscription(ctx, "o", "r") }) } + +func TestSubscription_Marshal(t *testing.T) { + testJSONMarshal(t, &Subscription{}, "{}") + + u := &Subscription{ + Subscribed: Bool(true), + Ignored: Bool(false), + Reason: String("r"), + CreatedAt: &Timestamp{referenceTime}, + URL: String("u"), + RepositoryURL: String("ru"), + ThreadURL: String("tu"), + } + + want := `{ + "subscribed": true, + "ignored": false, + "reason": "r", + "created_at": ` + referenceTimeStr + `, + "url": "u", + "repository_url": "ru", + "thread_url": "tu" + }` + + testJSONMarshal(t, u, want) +}