package httpserver import ( "os" "strings" "testing" ) func TestReplaceDomains(t *testing.T) { data, _ := os.ReadFile("../test/webpage_external_domains.html") testDomain := "website.domain.org" got := replaceDomains(string(data), testDomain) os.WriteFile("post.html", data, os.ModePerm) if strings.Contains(got, "www.gstatic.com") { t.Error("Test failed! found unaccepted domain in page source") } }