//go:build !integration

package version

import (
	"testing"

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

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

func Test_Version(t *testing.T) {
	ios, _, stdout, stderr := cmdtest.TestIOStreams()
	f := cmdtest.NewTestFactory(ios, cmdtest.WithBuildInfo(api.BuildInfo{Version: "v1.0.0", Commit: "abcdefgh"}))
	require.NoError(t, NewCmdVersion(f).Execute())

	assert.Equal(t, "glab 1.0.0 (abcdefgh)\n", stdout.String())
	assert.Empty(t, stderr.String())
}
