constellation/cli/cmd/version_test.go

26 lines
415 B
Go
Raw Normal View History

package cmd
import (
"bytes"
"io"
"testing"
2022-04-06 08:36:58 +00:00
"github.com/edgelesssys/constellation/internal/constants"
"github.com/stretchr/testify/assert"
)
func TestVersionCmd(t *testing.T) {
assert := assert.New(t)
cmd := newVersionCmd()
2022-04-13 11:01:38 +00:00
b := &bytes.Buffer{}
cmd.SetOut(b)
err := cmd.Execute()
assert.NoError(err)
s, err := io.ReadAll(b)
assert.NoError(err)
2022-04-06 08:36:58 +00:00
assert.Contains(string(s), constants.CliVersion)
}