Break out autolink list json fields test

This commit is contained in:
Michael Hoffman 2024-12-27 21:43:47 -05:00
parent 67266e9cb8
commit cc24289832

View file

@ -11,11 +11,21 @@ import (
"github.com/cli/cli/v2/internal/ghrepo"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/jsonfieldstest"
"github.com/google/shlex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestJSONFields(t *testing.T) {
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdList, []string{
"id",
"isAlphanumeric",
"keyPrefix",
"urlTemplate",
})
}
func TestNewCmdList(t *testing.T) {
tests := []struct {
name string
@ -41,18 +51,6 @@ func TestNewCmdList(t *testing.T) {
output: listOptions{},
wantExporter: true,
},
{
name: "invalid json flag",
input: "--json invalid",
wantErr: true,
errMsg: heredoc.Doc(`
Unknown JSON field: "invalid"
Available fields:
id
isAlphanumeric
keyPrefix
urlTemplate`),
},
}
for _, tt := range tests {