forked from toolshed/abra
return error instead of handling it inside getLatestVersion
This commit is contained in:
@ -7,11 +7,11 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetLatestVersionReturnsDefault(t *testing.T) {
|
||||
func TestGetLatestVersionReturnsErrorWhenVersionsIsEmpty(t *testing.T) {
|
||||
recipe := recipePkg.Recipe{}
|
||||
catalogue := recipePkg.RecipeCatalogue{}
|
||||
version := getLatestVersion(recipe, catalogue)
|
||||
assert.Equal(t, version, "0.0.0")
|
||||
_, err := getLatestVersion(recipe, catalogue)
|
||||
assert.Equal(t, err, emptyVersionsInCatalogue)
|
||||
}
|
||||
|
||||
func TestGetLatestVersionReturnsLastVersion(t *testing.T) {
|
||||
@ -28,6 +28,6 @@ func TestGetLatestVersionReturnsLastVersion(t *testing.T) {
|
||||
catalogue["test"] = recipePkg.RecipeMeta{
|
||||
Versions: versions,
|
||||
}
|
||||
version := getLatestVersion(recipe, catalogue)
|
||||
version, _ := getLatestVersion(recipe, catalogue)
|
||||
assert.Equal(t, version, "0.0.3")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user