test: add unit test case for email notifier

This commit is contained in:
Fu Diwei
2024-11-10 20:28:01 +08:00
parent 1bedb31a3c
commit 2994cb5c65
3 changed files with 54 additions and 5 deletions

View File

@@ -154,10 +154,8 @@ func GetValueOrDefaultAsBool(dict map[string]any, key string, defaultValue bool)
// 兼容字符串类型的值
if str, ok := value.(string); ok {
if str == "true" || str == "True" || str == "1" {
return true
} else if str == "false" || str == "False" || str == "0" {
return false
if result, err := strconv.ParseBool(str); err == nil {
return result
}
}
}