package renderers
import (
"log"
"testing"
"github.com/stretchr/testify/require"
)
func TestRenderMarkdown(t *testing.T) {
require.Equal(t, "
b
\n", mustMarkdownString("*b*"))
}
func TestRenderMarkdownWithHtml1(t *testing.T) {
require.Equal(t, "\n", mustMarkdownString(`*b*
`))
require.Equal(t, "\n", mustMarkdownString(`*b*
`))
require.Equal(t, "\n", mustMarkdownString(`*b*
`))
require.Equal(t, "", ``)
}
func TestRenderMarkdownWithHtml2(t *testing.T) {
t.Skip("skipping broken test.")
// FIXME for now, manually test against against site/testdata/site1/markdown.md.
// These render correctly in the entire pipeline, but not in the test.
require.Equal(t, "*b*
\n", mustMarkdownString("*b*
"))
require.Contains(t, mustMarkdownString(`
`), `user@example.com`)
require.Contains(t, mustMarkdownString(`
`), `http://example.com`)
}
func mustMarkdownString(md string) string {
s, err := renderMarkdown([]byte(md))
if err != nil {
log.Fatal(err)
}
return string(s)
}
// func renderMarkdownString(md string) (string, error) {
// s, err := renderMarkdown([]byte(md))
// if err != nil {
// return "", err
// }
// return string(s), err
// }