Skip to content

Commit

Permalink
add markdown tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aine-etke committed Oct 10, 2024
1 parent d2f4629 commit 16f6ba2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions format/markdown_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package format

import (
"testing"
)

func TestRenderBasicMarkdown(t *testing.T) {
md := "**bold text**"
expected := "<strong>bold text</strong>"
got := Render(md)

if got != expected {
t.Errorf("Render() = %v, want %v", got, expected)
}
}

func TestRenderWithParagraphWrapping(t *testing.T) {
md := "This is a test."
expected := "This is a test."
got := Render(md)

if got != expected {
t.Errorf("Render() = %v, want %v", got, expected)
}
}

func TestRenderWithMultipleParagraphs(t *testing.T) {
md := "This is the first paragraph.\n\nThis is the second paragraph."
expected := "This is the first paragraph.<br><br>This is the second paragraph."
got := Render(md)

if got != expected {
t.Errorf("Render() = %v, want %v", got, expected)
}
}

func TestRenderWithLinks(t *testing.T) {
md := "[Link](https://example.com)"
expected := `<a href="https://example.com" target="_blank">Link</a>`
got := Render(md)

if got != expected {
t.Errorf("Render() = %v, want %v", got, expected)
}
}

0 comments on commit 16f6ba2

Please sign in to comment.