-
Notifications
You must be signed in to change notification settings - Fork 0
/
scaper_test.go
42 lines (35 loc) · 875 Bytes
/
scaper_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
38
39
40
41
42
package domainpricescraper_test
import (
"github.com/tunaitis/domainpricescraper"
"github.com/tunaitis/domainpricescraper/domain"
"sort"
"testing"
)
func TestScraper_UseDomain_DomainOrder(t *testing.T) {
s := domainpricescraper.NewScraper()
s.UseDomain(domain.Eu)
s.UseDomain(domain.Dev)
s.UseDomain(domain.Com)
wanted := make([]string, len(s.Domains))
copy(wanted, s.Domains)
sort.Strings(wanted)
for i := range wanted {
if s.Domains[i] != wanted[i] {
t.Errorf("got %s wanted %s", s.Domains, wanted)
break
}
}
}
func TestScraper_UseAllDomains_DomainOrder(t *testing.T) {
s := domainpricescraper.NewScraper()
s.UseAllDomains()
wanted := make([]string, len(s.Domains))
copy(wanted, s.Domains)
sort.Strings(wanted)
for i := range wanted {
if s.Domains[i] != wanted[i] {
t.Errorf("got %s wanted %s", s.Domains, wanted)
break
}
}
}