//go:build !integration

package tag

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
)

func TestNewCmd(t *testing.T) {
	t.Parallel()

	cmd := NewCmd(cmdtest.NewTestFactory(nil))

	assert.Equal(t, "tag <command> [flags]", cmd.Use)
	assert.Contains(t, cmd.Aliases, "tags")
	listCmd, _, err := cmd.Find([]string{"list"})
	require.NoError(t, err)
	assert.Equal(t, "list <repository-id> [flags]", listCmd.Use)
	viewCmd, _, err := cmd.Find([]string{"view"})
	require.NoError(t, err)
	assert.Equal(t, "view <repository-id> <tag-name> [flags]", viewCmd.Use)
	deleteCmd, _, err := cmd.Find([]string{"delete"})
	require.NoError(t, err)
	assert.Equal(t, "delete <repository-id> [<tag-name>] [flags]", deleteCmd.Use)
}
