Skip to content

Commit

Permalink
Rename test and add 2 test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shackra committed Sep 20, 2024
1 parent 60748e8 commit cfcd6c3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions internal/tests/notrequireargsinsubcommands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,29 @@ import (
"github.com/stretchr/testify/require"
)

func TestCallSubCommandHelp(t *testing.T) {
func TestCallSubCommand(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), timeoutIn)
defer cancel()

requiredField := field.StringField("name", field.WithRequired(true))
carrier := field.NewConfiguration(
[]field.SchemaField{
requiredField,
},
)

t.Run("should run help sub-command successfully", func(t *testing.T) {
carrier := field.NewConfiguration(
[]field.SchemaField{
requiredField,
},
)
t.Run("should run «help» sub-command successfully", func(t *testing.T) {
_, err := entrypoint(ctx, carrier, "help")
require.NoError(t, err)
})

t.Run("should run «capabilities» sub-command without success", func(t *testing.T) {
_, err := entrypoint(ctx, carrier, "capabilities")
require.Error(t, err)
})

t.Run("should run «completion zsh» sub-command successfully", func(t *testing.T) {
_, err := entrypoint(ctx, carrier, "completion", "zsh")
require.NoError(t, err)
})
}

0 comments on commit cfcd6c3

Please sign in to comment.