aboutsummaryrefslogtreecommitdiff
path: root/html_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'html_test.go')
-rw-r--r--html_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/html_test.go b/html_test.go
index b7fdf1a..8051b30 100644
--- a/html_test.go
+++ b/html_test.go
@@ -9,6 +9,9 @@ import (
)
func TestGetHumanFromHTML(t *testing.T) {
+ if testing.Short() {
+ t.SkipNow()
+ }
client := http.DefaultClient
// using human.json author's website
resp, err := client.Get(`https://robida.net/`)
@@ -87,6 +90,27 @@ func TestGetURLFromHTML(t *testing.T) {
if u.Host != "example.org" {
t.Errorf("invalid host: %s", u.Host)
}
+
+ realSample := `<link rel="stylesheet" href="/static/css/pico.min.css">
+ <link rel="stylesheet" href="/static/css/style.css">
+ <link rel="stylesheet" href="/static/css/leaflet.min.css">
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg">
+ <link rel="manifest" href="/static/manifest.json">
+ <link rel="human-json" href="/human.json">
+ <link rel="webmention" href="/webmention">`
+ u, err = GetURLFromHTML([]byte(realSample), base)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if u == nil {
+ t.Fatal("not found")
+ }
+ if u.Path != "/human.json" {
+ t.Errorf("invalid path: %s", u.Path)
+ }
+ if u.Host != "example.org" {
+ t.Errorf("invalid host: %s", u.Host)
+ }
}
func TestParseArgs(t *testing.T) {