master: added functionality to IsValid

This commit is contained in:
luke.rodham
2018-07-12 09:49:26 +01:00
parent 4e26d037b5
commit 86faadca64
2 changed files with 37 additions and 0 deletions

View File

@@ -51,3 +51,30 @@ func TestIsGeneric(t *testing.T) {
}
}
}
func TestIsValid(t *testing.T) {
tests := []struct {
Email string
ShouldError bool
}{
{
Email: "example@asdas_-3-43222.com",
ShouldError: true,
},
{
Email: "example--3-43222.com",
ShouldError: true,
},
{
Email: "example@hotmail.com",
ShouldError: false,
},
}
for _, test := range tests {
err := checker.IsValid(test.Email)
if err != nil && test.ShouldError == false {
t.Error(err)
}
}
}