cicd: Increase coverage (#280)

This commit is contained in:
James Read 2024-04-19 22:56:45 +01:00 committed by GitHub
parent fafacfeafb
commit 86b2187236
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 1 deletions

View File

@ -111,7 +111,7 @@ func updateEvmFromFile(entityname string, data []map[string]string) {
sv.RemoveKeysThatStartWith("entities." + entityname)
sv.Set("entities."+entityname+".count", fmt.Sprintf("%v", count))
sv.SetEntityCount(entityname, count)
for i, mapp := range data {
prefix := "entities." + entityname + "." + fmt.Sprintf("%v", i)

View File

@ -61,3 +61,7 @@ func GetEntityCount(entityTitle string) int {
return count
}
func SetEntityCount(entityTitle string, count int) {
Set("entities."+entityTitle+".count", fmt.Sprintf("%v", count))
}

View File

@ -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"))
}

View File

@ -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)
}