Add more unit tests

This commit is contained in:
Jamie Curnow
2024-11-07 13:00:07 +10:00
parent 208037946f
commit 3774a40498
14 changed files with 810 additions and 24 deletions

View File

@ -0,0 +1,33 @@
package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseBoolValue(t *testing.T) {
tests := []struct {
input string
expected []string
}{
{"yes", []string{"1"}},
{"true", []string{"1"}},
{"on", []string{"1"}},
{"t", []string{"1"}},
{"1", []string{"1"}},
{"y", []string{"1"}},
{"no", []string{"0"}},
{"false", []string{"0"}},
{"off", []string{"0"}},
{"f", []string{"0"}},
{"0", []string{"0"}},
{"n", []string{"0"}},
{"random", []string{"0"}},
}
for _, test := range tests {
result := parseBoolValue(test.input)
assert.Equal(t, test.expected, result, "Input: %s", test.input)
}
}