package gmi2html import ( "strings" "testing" ) func TestConvertGeminiContent(t *testing.T) { tests := []struct { name string input string expected string }{ { name: "Simple text line", input: "This is a simple text line", expected: `

This is a simple text line

`, }, { name: "Heading line level 1", input: "# Main heading", expected: `

Main heading

`, }, { name: "Link line with description", input: "=> https://example.com Example site", expected: ``, }, { name: "List item", input: "* List item 1", expected: `

• List item 1

`, }, { name: "Quote line", input: "> This is a quote", expected: `
This is a quote
`, }, { name: "Preformatted text", input: "```\ncode line 1\ncode line 2\n```", expected: `
code line 1
code line 2
`, }, { name: "Mixed content", input: "# Title\n\nNormal paragraph\n\n=> https://example.com Link to example", expected: `

Title

Normal paragraph

`, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := convertGeminiContent(tt.input) if result != tt.expected { t.Errorf("convertGeminiContent(%q):\ngot: %s\nwant: %s", tt.input, result, tt.expected) } }) } } func TestGmi2html(t *testing.T) { sample := "# Hello Gemini\n\nThis is a test document.\n\n=> https://gemini.circumlunar.space/ Project Gemini" result, _ := Gmi2html(sample, "Gemini Test") // Check that it contains the expected elements if !strings.Contains(result, "Gemini Test") { t.Error("Output HTML missing title") } if !strings.Contains(result, "

Hello Gemini

") { t.Error("Output HTML missing properly formatted heading") } if !strings.Contains(result, "Project Gemini") { t.Error("Output HTML missing properly formatted link") } // Check that CSS is included if !strings.Contains(result, "