summaryrefslogtreecommitdiff
path: root/internal/summary/summary_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-01-19 13:17:50 +0200
committerPaul Buetow <paul@buetow.org>2025-01-19 13:17:50 +0200
commitc77e07805c98a7a53bc62deeb21acf6f01195ca9 (patch)
tree9a03b12ae6c3e25b553ea14b432594f63a19072b /internal/summary/summary_test.go
parentc0a710cca29fc2c2ed641d8c364ef971f934d61b (diff)
change the gemini prefix procedure
Diffstat (limited to 'internal/summary/summary_test.go')
-rw-r--r--internal/summary/summary_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/summary/summary_test.go b/internal/summary/summary_test.go
index fffc896..4846878 100644
--- a/internal/summary/summary_test.go
+++ b/internal/summary/summary_test.go
@@ -3,22 +3,23 @@ package summary
import "testing"
func TestGemtextLink(t *testing.T) {
- const geminiCapsule = "foo.zone"
+ T = t
+ geminiCapsules := []string{"foo.zone"}
table := map[string]string{
"http://example.com": "=> http://example.com example.com",
"https://example.org": "=> https://example.org example.org",
"https://example.org/some/very/long/link/here?with=a&free=of&parameters=here": "=> https://example.org/some/very/long/link/here?with=a&free=of&parameters=here example.org/s...rameters=here",
- // TODO: Refactor, so that internal links refer to ./ and that the suffix .gmi and/or .html is hidden if possible
- "beer://foo.zone": "=> beer://foo.zone foo.zone",
- "http://foo.zone": "=> one foo.zone",
- "https://foo.zone/index.html": "=> gemini://foo.zone/index.gmi foo.zone/index.gmi",
- "https://foo.zone/gemtext/this-is-awesome.html": "=> gemini://foo.zone/gemtext/this-is-awesome.gmi foo.zone/gemt...s-awesome.gmi",
+ "beer://foo.zone": "=> beer://foo.zone foo.zone",
+ "http://foo.zone": "=> gemini://foo.zone foo.zone (Gemini)\n=> http://foo.zone foo.zone",
+ "https://foo.zone/index.html": "=> gemini://foo.zone/index.gmi foo.zone/index.gmi (Gemini)\n=> https://foo.zone/index.html foo.zone/index.html",
+
+ "https://foo.zone/gemtext/this-is-awesome.html": "=> gemini://foo.zone/gemtext/this-is-awesome.gmi foo.zone/gemt...s-awesome.gmi (Gemini)\n=> https://foo.zone/gemtext/this-is-awesome.html foo.zone/gemt...-awesome.html",
}
for url, expected := range table {
- if result := gemtextLink(geminiCapsule, url, 30); result != expected {
+ if result := gemtextLink(geminiCapsules, url, 30); result != expected {
t.Errorf("Expected '%s' but got '%s' with input '%s'", expected, result, url)
}
}