diff --git a/packages/cmd/secrets.go b/packages/cmd/secrets.go index 4d37065a..2b9d4c37 100644 --- a/packages/cmd/secrets.go +++ b/packages/cmd/secrets.go @@ -853,7 +853,7 @@ func init() { secretsSetCmd.Flags().Bool("show-values", false, "reveal secret values in the output table instead of masking them") util.AddOutputFlagsToCmd(secretsSetCmd, "The output to format the secrets in.") - secretsDeleteCmd.Flags().String("type", "personal", "the type of secret to delete: personal or shared (default: personal)") + secretsDeleteCmd.Flags().String("type", util.SECRET_TYPE_SHARED, "the type of secret to delete: personal or shared") secretsDeleteCmd.Flags().String("token", "", "Fetch secrets using service token or machine identity access token") secretsDeleteCmd.Flags().String("projectId", "", "manually set the projectId to delete secrets from when using machine identity based auth") secretsDeleteCmd.Flags().String("path", "/", "get secrets within a folder path") diff --git a/packages/cmd/secrets_test.go b/packages/cmd/secrets_test.go new file mode 100644 index 00000000..4d809b4b --- /dev/null +++ b/packages/cmd/secrets_test.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "testing" + + "github.com/Infisical/infisical-merge/packages/util" + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestSecretsTypeFlagDefaults(t *testing.T) { + tests := []struct { + name string + cmd *cobra.Command + }{ + {"secrets set", secretsSetCmd}, + {"secrets delete", secretsDeleteCmd}, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + flag := tc.cmd.Flags().Lookup("type") + require.NotNil(t, flag, "the type flag should be registered") + assert.Equal(t, util.SECRET_TYPE_SHARED, flag.DefValue) + }) + } +}