package sanitize_test import ( "testing" "github.com/inbucket/inbucket/pkg/webui/sanitize" ) // TestHTMLPlainStrings test plain text passthrough func TestHTMLPlainStrings(t *testing.T) { testStrings := []string{ "", "plain string", "one < two", } for _, ts := range testStrings { t.Run(ts, func(t *testing.T) { got, err := sanitize.HTML(ts) if err != nil { t.Fatal(err) } if got != ts { t.Errorf("Got: %q, want: %q", got, ts) } }) } } // TestHTMLSimpleFormatting tests basic tags we should allow func TestHTMLSimpleFormatting(t *testing.T) { testStrings := []string{ "
paragraph
", "bold", "italic", "emphasis", "strong", "some text
`, `some text
`, }, { "invalid styles", `