Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions api/queries_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type Repository struct {
MirrorURL string
SecurityPolicyURL string

CreatedAt time.Time
PushedAt *time.Time
UpdatedAt time.Time
CreatedAt time.Time
PushedAt *time.Time
UpdatedAt time.Time
ArchivedAt *time.Time

IsBlankIssuesEnabled bool
IsSecurityPolicyEnabled bool
Expand Down
1 change: 1 addition & 0 deletions api/query_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ var RepositoryFields = []string{
"createdAt",
"pushedAt",
"updatedAt",
"archivedAt",

"isBlankIssuesEnabled",
"isSecurityPolicyEnabled",
Expand Down
73 changes: 73 additions & 0 deletions pkg/cmd/repo/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,82 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/jsonfieldstest"
"github.com/cli/cli/v2/test"
)

func TestJSONFields(t *testing.T) {
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdList, []string{
"archivedAt",
"assignableUsers",
"codeOfConduct",
"contactLinks",
"createdAt",
"defaultBranchRef",
"deleteBranchOnMerge",
"description",
"diskUsage",
"forkCount",
"fundingLinks",
"hasDiscussionsEnabled",
"hasIssuesEnabled",
"hasProjectsEnabled",
"hasWikiEnabled",
"homepageUrl",
"id",
"isArchived",
"isBlankIssuesEnabled",
"isEmpty",
"isFork",
"isInOrganization",
"isMirror",
"isPrivate",
"isSecurityPolicyEnabled",
"isTemplate",
"isUserConfigurationRepository",
"issueTemplates",
"issues",
"labels",
"languages",
"latestRelease",
"licenseInfo",
"mentionableUsers",
"mergeCommitAllowed",
"milestones",
"mirrorUrl",
"name",
"nameWithOwner",
"openGraphImageUrl",
"owner",
"parent",
"primaryLanguage",
"projects",
"projectsV2",
"pullRequestTemplates",
"pullRequests",
"pushedAt",
"rebaseMergeAllowed",
"repositoryTopics",
"securityPolicyUrl",
"sshUrl",
"squashMergeAllowed",
"stargazerCount",
"templateRepository",
"updatedAt",
"url",
"usesCustomOpenGraphImage",
"viewerCanAdminister",
"viewerDefaultCommitEmail",
"viewerDefaultMergeMethod",
"viewerHasStarred",
"viewerPermission",
"viewerPossibleCommitEmails",
"viewerSubscription",
"visibility",
"watchers",
})
}

func TestNewCmdList(t *testing.T) {
tests := []struct {
name string
Expand Down
73 changes: 73 additions & 0 deletions pkg/cmd/repo/view/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,83 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/jsonfieldstest"
"github.com/google/shlex"
"github.com/stretchr/testify/assert"
)

func TestJSONFields(t *testing.T) {
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdView, []string{
"archivedAt",
"assignableUsers",
"codeOfConduct",
"contactLinks",
"createdAt",
"defaultBranchRef",
"deleteBranchOnMerge",
"description",
"diskUsage",
"forkCount",
"fundingLinks",
"hasDiscussionsEnabled",
"hasIssuesEnabled",
"hasProjectsEnabled",
"hasWikiEnabled",
"homepageUrl",
"id",
"isArchived",
"isBlankIssuesEnabled",
"isEmpty",
"isFork",
"isInOrganization",
"isMirror",
"isPrivate",
"isSecurityPolicyEnabled",
"isTemplate",
"isUserConfigurationRepository",
"issueTemplates",
"issues",
"labels",
"languages",
"latestRelease",
"licenseInfo",
"mentionableUsers",
"mergeCommitAllowed",
"milestones",
"mirrorUrl",
"name",
"nameWithOwner",
"openGraphImageUrl",
"owner",
"parent",
"primaryLanguage",
"projects",
"projectsV2",
"pullRequestTemplates",
"pullRequests",
"pushedAt",
"rebaseMergeAllowed",
"repositoryTopics",
"securityPolicyUrl",
"sshUrl",
"squashMergeAllowed",
"stargazerCount",
"templateRepository",
"updatedAt",
"url",
"usesCustomOpenGraphImage",
"viewerCanAdminister",
"viewerDefaultCommitEmail",
"viewerDefaultMergeMethod",
"viewerHasStarred",
"viewerPermission",
"viewerPossibleCommitEmails",
"viewerSubscription",
"visibility",
"watchers",
})
}

func TestNewCmdView(t *testing.T) {
tests := []struct {
name string
Expand Down