-
Notifications
You must be signed in to change notification settings - Fork 0
/
dea_test.go
31 lines (27 loc) · 909 Bytes
/
dea_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package dea
import (
"reflect"
"testing"
)
func TestIsDisposableEmail(t *testing.T) {
tests := []struct {
name string
inputEmail string
want bool
}{
{name: "Check against valid email", inputEmail: "prabesh66@gmail.com", want: false},
{name: "Check against invalid email", inputEmail: "demo@027168.com", want: true},
{name: "Check against random string", inputEmail: "asdsadasdkjh@asdjkhasd.com", want: true},
{name: "Check against empty strng", inputEmail: "", want: true},
{name: "Check against invalid email format", inputEmail: "@2or.com", want: true},
{name: "Check against empty email format", inputEmail: "12345", want: true},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
got, _ := IsDisposableEmail(tc.inputEmail)
if !reflect.DeepEqual(got, tc.want) {
t.Fatalf("%s: expected: %#v, got: %#v", tc.name, tc.want, got)
}
})
}
}