mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-15 14:20:25 +08:00
35 lines
783 B
Go
35 lines
783 B
Go
package logic
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/matryer/is"
|
|
)
|
|
|
|
func TestVersion(t *testing.T) {
|
|
t.Run("valid version", func(t *testing.T) {
|
|
is := is.New(t)
|
|
valid := IsVersionComptatible("v0.17.1-testing")
|
|
is.Equal(valid, true)
|
|
})
|
|
t.Run("dev version", func(t *testing.T) {
|
|
is := is.New(t)
|
|
valid := IsVersionComptatible("dev")
|
|
is.Equal(valid, true)
|
|
})
|
|
t.Run("invalid version", func(t *testing.T) {
|
|
is := is.New(t)
|
|
valid := IsVersionComptatible("v0.14.2-refactor")
|
|
is.Equal(valid, false)
|
|
})
|
|
t.Run("no version", func(t *testing.T) {
|
|
is := is.New(t)
|
|
valid := IsVersionComptatible("testing")
|
|
is.Equal(valid, false)
|
|
})
|
|
t.Run("incomplete version", func(t *testing.T) {
|
|
is := is.New(t)
|
|
valid := IsVersionComptatible("0.18")
|
|
is.Equal(valid, true)
|
|
})
|
|
}
|