feat(05-05): accept boolean validation token
- Treat Laravel boolean as a type-check no-op in lagoon.Validate - Settings.search_use_typesense uses this rule string
This commit is contained in:
@@ -73,6 +73,19 @@ func TestValidateMoneyRange(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateBooleanNoop(t *testing.T) {
|
||||
rules := map[string]string{"search_use_typesense": "boolean"}
|
||||
for _, v := range []any{true, false} {
|
||||
errs, err := Validate(t.Context(), nil, nil, rules, map[string]any{"search_use_typesense": v}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(errs) != 0 {
|
||||
t.Fatalf("boolean %v = %v", v, errs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateUnrecognizedRule(t *testing.T) {
|
||||
_, err := Validate(t.Context(), nil, nil, map[string]string{"name": "required|nope"}, map[string]any{"name": "x"}, nil)
|
||||
if err == nil || !strings.Contains(err.Error(), "nope") {
|
||||
|
||||
Reference in New Issue
Block a user