cicd: Increase coverage (#280)
This commit is contained in:
parent
fafacfeafb
commit
86b2187236
|
|
@ -111,7 +111,7 @@ func updateEvmFromFile(entityname string, data []map[string]string) {
|
||||||
|
|
||||||
sv.RemoveKeysThatStartWith("entities." + entityname)
|
sv.RemoveKeysThatStartWith("entities." + entityname)
|
||||||
|
|
||||||
sv.Set("entities."+entityname+".count", fmt.Sprintf("%v", count))
|
sv.SetEntityCount(entityname, count)
|
||||||
|
|
||||||
for i, mapp := range data {
|
for i, mapp := range data {
|
||||||
prefix := "entities." + entityname + "." + fmt.Sprintf("%v", i)
|
prefix := "entities." + entityname + "." + fmt.Sprintf("%v", i)
|
||||||
|
|
|
||||||
|
|
@ -61,3 +61,7 @@ func GetEntityCount(entityTitle string) int {
|
||||||
|
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetEntityCount(entityTitle string, count int) {
|
||||||
|
Set("entities."+entityTitle+".count", fmt.Sprintf("%v", count))
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package stringvariables
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestEntityCount(t *testing.T) {
|
||||||
|
SetEntityCount("waffles", 3)
|
||||||
|
|
||||||
|
assert.Equal(t, 3, GetEntityCount("waffles"))
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package stringvariables
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetAndSet(t *testing.T) {
|
||||||
|
Set("foo", "bar")
|
||||||
|
Set("salutation", "hello")
|
||||||
|
|
||||||
|
assert.Equal(t, "bar", Get("foo"))
|
||||||
|
assert.Equal(t, "", Get("not exist"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetall(t *testing.T) {
|
||||||
|
ret := GetAll()
|
||||||
|
|
||||||
|
assert.NotEmpty(t, ret)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue