Files
aura-crm/production/backend/internal/document/handler_test.go
T

26 lines
629 B
Go

package document
import "testing"
func TestFormatCustomFieldValue(t *testing.T) {
cases := []struct {
name string
in any
want string
}{
{"bool true", true, "Да"},
{"bool false", false, "Нет"},
{"number", 42.5, "42.5"},
{"whole number renders without trailing zero", float64(3), "3"},
{"string", "Наличные", "Наличные"},
{"unsupported type", []string{"x"}, ""},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
if got := formatCustomFieldValue(tc.in); got != tc.want {
t.Errorf("formatCustomFieldValue(%v) = %q, want %q", tc.in, got, tc.want)
}
})
}
}