Selaa lähdekoodia

add more tests

kevin 4 vuotta sitten
vanhempi
sitoutus
096fe3bc47
1 muutettua tiedostoa jossa 26 lisäystä ja 0 poistoa
  1. 26 0
      core/stores/cache/util_test.go

+ 26 - 0
core/stores/cache/util_test.go

@@ -0,0 +1,26 @@
+package cache
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestFormatKeys(t *testing.T) {
+	assert.Equal(t, "a,b", formatKeys([]string{"a", "b"}))
+}
+
+func TestTotalWeights(t *testing.T) {
+	val := TotalWeights([]NodeConf{
+		{
+			Weight: -1,
+		},
+		{
+			Weight: 0,
+		},
+		{
+			Weight: 1,
+		},
+	})
+	assert.Equal(t, 1, val)
+}