Skip to content

Commit

Permalink
Add test for resource JSON marshaling - ActionVariable (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
ResamVi authored Oct 1, 2023
1 parent d99d3df commit 25309f3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions github/actions_variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,31 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) {
return client.Actions.DeleteEnvVariable(ctx, 1, "r", "variable")
})
}

func TestActionVariable_Marshal(t *testing.T) {
testJSONMarshal(t, &ActionsVariable{}, "{}")

av := &ActionsVariable{
Name: "n",
Value: "v",
CreatedAt: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
Visibility: String("v"),
SelectedRepositoriesURL: String("s"),
SelectedRepositoryIDs: &SelectedRepoIDs{1, 2, 3},
}

want := fmt.Sprintf(`{
"name": "n",
"value": "v",
"created_at": %s,
"updated_at": %s,
"visibility": "v",
"selected_repositories_url": "s",
"selected_repository_ids": [1,2,3]
}`, referenceTimeStr, referenceTimeStr)

fmt.Println(want)

testJSONMarshal(t, av, want)
}

0 comments on commit 25309f3

Please sign in to comment.