util_test.go 344 B

1234567891011121314151617181920212223242526
  1. package cache
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestFormatKeys(t *testing.T) {
  7. assert.Equal(t, "a,b", formatKeys([]string{"a", "b"}))
  8. }
  9. func TestTotalWeights(t *testing.T) {
  10. val := TotalWeights([]NodeConf{
  11. {
  12. Weight: -1,
  13. },
  14. {
  15. Weight: 0,
  16. },
  17. {
  18. Weight: 1,
  19. },
  20. })
  21. assert.Equal(t, 1, val)
  22. }