-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubdomain_test.go
37 lines (30 loc) · 896 Bytes
/
subdomain_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 main
import "testing"
type SubdomainTest struct {
Name string
Args SubdomainTestArgs
Exptected SubdomainTestExpected
}
type SubdomainTestArgs struct {
Address string
}
type SubdomainTestExpected struct {
HasItems bool
}
var SubdomainTests = []SubdomainTest{
SubdomainTest{"Should get multiple items", SubdomainTestArgs{"tesla.com"}, SubdomainTestExpected{true}},
SubdomainTest{"Should get no items", SubdomainTestArgs{"rynfixme.com"}, SubdomainTestExpected{false}},
}
func TestSubdomain(t *testing.T) {
for _, tt := range SubdomainTests {
t.Run(tt.Name, func(t *testing.T) {
sprov := SubdomainScraperProvider[SubdomainResult]{}
c := SubdomainClient{&tt.Args.Address, nil, &sprov}
got := c.Search()
if len(got.Items) > 0 != tt.Exptected.HasItems {
t.Errorf("TestSubdomain(), %v, HasItems error, %v", tt.Name, got.Items)
return
}
})
}
}