From cfcd6c367c6836de8ce1b26bb7f58a3f9815a1cc Mon Sep 17 00:00:00 2001 From: Jorge Javier Araya Navarro Date: Thu, 19 Sep 2024 19:36:27 -0600 Subject: [PATCH] Rename test and add 2 test cases --- .../tests/notrequireargsinsubcommands_test.go | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/internal/tests/notrequireargsinsubcommands_test.go b/internal/tests/notrequireargsinsubcommands_test.go index 03196ffa..2420ba0b 100644 --- a/internal/tests/notrequireargsinsubcommands_test.go +++ b/internal/tests/notrequireargsinsubcommands_test.go @@ -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) + }) }