aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/worker_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-02-11 10:47:42 +0700
committerShulhan <ms@kilabit.info>2026-02-11 21:45:06 +0700
commit8100b3be0730173a77f1a64f9ac6bc8862a159ac (patch)
tree46d0bdb4a6f3e6c5e709826d61d34259e209d3a4 /brokenlinks/worker_test.go
parente59724f4d701f8889167219b2ccc18f4e8954034 (diff)
downloadjarink-8100b3be0730173a77f1a64f9ac6bc8862a159ac.tar.xz
brokenlinks: make link that return HTML always end with slash
If parent URL like "/page" return the body as HTML page, the URL should be end with slash to make the relative links inside it works when joined with the parent URL.
Diffstat (limited to 'brokenlinks/worker_test.go')
-rw-r--r--brokenlinks/worker_test.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/brokenlinks/worker_test.go b/brokenlinks/worker_test.go
index 122221e..a125092 100644
--- a/brokenlinks/worker_test.go
+++ b/brokenlinks/worker_test.go
@@ -2,47 +2,3 @@
// SPDX-FileCopyrightText: 2026 M. Shulhan <ms@kilabit.info>
package brokenlinks
-
-import (
- "net/url"
- "testing"
-
- "git.sr.ht/~shulhan/pakakeh.go/lib/test"
-)
-
-func TestGenURLRelative(t *testing.T) {
- listCase := []struct {
- parentURL string
- relPath string
- expURL string
- }{{
- parentURL: `https://domain/a/b/`,
- relPath: `c`,
- expURL: `https://domain/a/b/c`,
- }, {
- parentURL: `https://domain/a/b`,
- relPath: `c`,
- expURL: `https://domain/a/b/c`,
- }, {
- parentURL: `https://domain/a/b/page.html`,
- relPath: `c`,
- expURL: `https://domain/a/b/c`,
- }, {
- parentURL: `https://domain/a/b/page.htm`,
- relPath: `c`,
- expURL: `https://domain/a/b/c`,
- }, {
- parentURL: `https://domain/a/b/page.HTML`,
- relPath: `c`,
- expURL: `https://domain/a/b/c`,
- }, {
- parentURL: `https://domain/a/b/page.HTML`,
- relPath: `../c.html`,
- expURL: `https://domain/a/c.html`,
- }}
- for _, tc := range listCase {
- parentURL, _ := url.Parse(tc.parentURL)
- got := genURLRelative(parentURL, tc.relPath)
- test.Assert(t, ``, tc.expURL, got.String())
- }
-}