test(settings): cover the new float setting type in the defaults audit

TestSettingDefaults enumerates registry types; 'float' hit the unknown-
type branch. Added float validation (default parses, within [min,max])
mirroring the int case.
This commit is contained in:
John O'Keefe committed 2026-10-30 10:31:02 -04:00
1 parent b574df346a
commit 0da8e0cdf9
1 file changed
+15
@@ -36,6 +36,21 @@ func TestSettingDefaults(t *testing.T) {
if _, err := strconv.ParseBool(d.Value); err != nil {
t.Errorf("bool setting %s default %q is not a bool", d.Key, d.Value)
}
case SettingTypeFloat:
f, err := strconv.ParseFloat(d.Value, 64)
if err != nil {
t.Errorf("float setting %s default %q is not a float", d.Key, d.Value)
}
if d.Min != "" {
if mn, err := strconv.ParseFloat(d.Min, 64); err == nil && f < mn {
t.Errorf("float setting %s default %q below min %q", d.Key, d.Value, d.Min)
}
}
if d.Max != "" {
if mx, err := strconv.ParseFloat(d.Max, 64); err == nil && f > mx {
t.Errorf("float setting %s default %q above max %q", d.Key, d.Value, d.Max)
}
}
case SettingTypeString:
if d.Value == "" {
t.Errorf("string setting %s has empty default", d.Key)