sq/cli/cmd_version_test.go
2022-12-30 10:10:56 -07:00

27 lines
520 B
Go

package cli
import (
"context"
"os"
"testing"
"golang.org/x/mod/semver"
"github.com/stretchr/testify/require"
)
func TestGetVersionFromBrewFormula(t *testing.T) {
f, err := os.ReadFile("testdata/sq-0.20.0.rb")
require.NoError(t, err)
vers, err := getVersionFromBrewFormula(f)
require.NoError(t, err)
require.Equal(t, "0.20.0", vers)
}
func TestFetchBrewVersion(t *testing.T) {
latest, err := fetchBrewVersion(context.Background())
require.NoError(t, err)
require.True(t, semver.IsValid("v"+latest))
}