All checks were successful
Tests / unit-tests (push) Successful in 51s
- Login sa session cookie autentifikacijom - Lista projekata iz filesystem-a - Chat sa Claude CLI preko WebSocket-a - Streaming NDJSON parsiranje iz CLI stdout-a - Sesija zivi nezavisno od browsera (reconnect replay) - Sidebar sa .md fajlovima i markdown renderovanjem - Dark tema, htmx + Go templates - 47 unit testova Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
680 B
Go
30 lines
680 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestRenderMarkdown(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
contains string
|
|
}{
|
|
{"plain text", "Hello world", "<p>Hello world</p>"},
|
|
{"bold", "**bold**", "<strong>bold</strong>"},
|
|
{"code block", "```\ncode\n```", "<code>code"},
|
|
{"inline code", "`inline`", "<code>inline</code>"},
|
|
{"heading", "# Title", "<h1>Title</h1>"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
result := renderMarkdown(tt.input)
|
|
if !strings.Contains(result, tt.contains) {
|
|
t.Errorf("renderMarkdown(%q) = %q, want to contain %q", tt.input, result, tt.contains)
|
|
}
|
|
})
|
|
}
|
|
}
|