diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-16 14:40:53 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-16 14:40:53 +0100 |
| commit | 2747bd581e1bae0a1436fcde984558304c005333 (patch) | |
| tree | a9ddc0dde8b4a17896e9dafb86b2906ed3104b19 /html_test.go | |
| parent | a75ea9362403a4d9da13bca2e3c1a44814723f0b (diff) | |
Diffstat (limited to 'html_test.go')
| -rw-r--r-- | html_test.go | 24 |
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) { |
