memos/internal/util/util_test.go

32 lines
474 B
Go
Raw Normal View History

2023-07-06 22:53:38 +08:00
package util
2022-08-20 21:03:15 +08:00
import (
"testing"
)
func TestValidateEmail(t *testing.T) {
tests := []struct {
email string
want bool
}{
{
email: "t@gmail.com",
want: true,
},
{
2024-08-12 23:44:04 +08:00
email: "@usememos.com",
2022-08-20 21:03:15 +08:00
want: false,
},
{
email: "1@gmail",
want: true,
},
}
for _, test := range tests {
result := ValidateEmail(test.email)
if result != test.want {
t.Errorf("Validate Email %s: got result %v, want %v.", test.email, result, test.want)
}
}
}