constellation/cli/cmd/version_test.go

26 lines
415 B
Go
Raw Normal View History

package cmd
import (
"bytes"
"io"
"testing"
2022-04-06 04:36:58 -04: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 07:01:38 -04:00
b := &bytes.Buffer{}
cmd.SetOut(b)
err := cmd.Execute()
assert.NoError(err)
s, err := io.ReadAll(b)
assert.NoError(err)
2022-04-06 04:36:58 -04:00
assert.Contains(string(s), constants.CliVersion)
}