2022-03-22 11:03:15 -04:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io"
|
|
|
|
"testing"
|
|
|
|
|
2022-04-06 04:36:58 -04:00
|
|
|
"github.com/edgelesssys/constellation/internal/constants"
|
2022-03-22 11:03:15 -04:00
|
|
|
"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{}
|
2022-03-22 11:03:15 -04:00
|
|
|
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)
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|