Break out autolink list json fields test
This commit is contained in:
parent
67266e9cb8
commit
cc24289832
1 changed files with 10 additions and 12 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue