2022-08-28 20:20:12 +02:00
|
|
|
package webconnectivity
|
2021-02-02 12:05:47 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFillASNsEmpty(t *testing.T) {
|
2022-08-28 20:20:12 +02:00
|
|
|
dns := new(ControlDNSResult)
|
|
|
|
fillASNs(dns)
|
2021-02-02 12:05:47 +01:00
|
|
|
if diff := cmp.Diff(dns.ASNs, []int64{}); diff != "" {
|
|
|
|
t.Fatal(diff)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFillASNsSuccess(t *testing.T) {
|
2022-08-28 20:20:12 +02:00
|
|
|
dns := new(ControlDNSResult)
|
2021-02-02 12:05:47 +01:00
|
|
|
dns.Addrs = []string{"8.8.8.8", "1.1.1.1"}
|
2022-08-28 20:20:12 +02:00
|
|
|
fillASNs(dns)
|
2021-02-02 12:05:47 +01:00
|
|
|
if diff := cmp.Diff(dns.ASNs, []int64{15169, 13335}); diff != "" {
|
|
|
|
t.Fatal(diff)
|
|
|
|
}
|
|
|
|
}
|