From 2ac6fb828f50f82f26fc6930c062a8c80c15dc63 Mon Sep 17 00:00:00 2001 From: vaibhavgholap23 <91172267+vaibhavgholap23@users.noreply.github.com> Date: Fri, 28 Oct 2022 20:11:56 +0530 Subject: [PATCH] Add test case for JSON resource marshaling (#2539) --- github/repos_environments_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 59b3f8b4688..93d0fc25ebc 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -426,3 +426,19 @@ func TestEnvironment_Marshal(t *testing.T) { testJSONMarshal(t, repoEnv, want) } + +func TestBranchPolicy_Marshal(t *testing.T) { + testJSONMarshal(t, &BranchPolicy{}, "{}") + + bp := &BranchPolicy{ + ProtectedBranches: Bool(false), + CustomBranchPolicies: Bool(false), + } + + want := `{ + "protected_branches": false, + "custom_branch_policies": false + }` + + testJSONMarshal(t, bp, want) +}