ooni-probe-cli/internal/engine/experiment/webconnectivity/control_test.go
Simone Basso bb6563f363
refactor: move TH structs and definitions to model (#894)
This commit moves the TH structs and definitions to model. We don't want
oohelperd to depend on web_connectivity@v0.4.

Part of https://github.com/ooni/probe/issues/2240
2022-08-28 20:20:12 +02:00

25 lines
462 B
Go

package webconnectivity
import (
"testing"
"github.com/google/go-cmp/cmp"
)
func TestFillASNsEmpty(t *testing.T) {
dns := new(ControlDNSResult)
fillASNs(dns)
if diff := cmp.Diff(dns.ASNs, []int64{}); diff != "" {
t.Fatal(diff)
}
}
func TestFillASNsSuccess(t *testing.T) {
dns := new(ControlDNSResult)
dns.Addrs = []string{"8.8.8.8", "1.1.1.1"}
fillASNs(dns)
if diff := cmp.Diff(dns.ASNs, []int64{15169, 13335}); diff != "" {
t.Fatal(diff)
}
}