-
Notifications
You must be signed in to change notification settings - Fork 3
/
email_finder_test.go
37 lines (34 loc) 路 791 Bytes
/
email_finder_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
32
33
34
35
36
37
package hunter
import (
"context"
"testing"
"time"
)
func TestClient_FindEmail(t *testing.T) {
results, err := client.FindEmail(Params{
"domain": "asana.com",
"first_name": "Dustin",
"last_name": "Moskovitz",
})
if err != nil {
t.Fatal(err)
}
if results.Data.Email != "[email protected]" {
t.Error("unable to find known email", results)
}
}
func TestClient_FindEmailWithContext(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
results, err := client.FindEmailWithContext(ctx, Params{
"domain": "asana.com",
"first_name": "Dustin",
"last_name": "Moskovitz",
})
if err != nil {
t.Fatal(err)
}
if results.Data.Email != "[email protected]" {
t.Error("unable to find known email", results)
}
}