package chat import ( "testing" "github.com/owncast/owncast/models" ) // Test a bunch of arbitrary markup and markdown to make sure we get sanitized // and fully rendered HTML out of it. func TestRenderAndSanitize(t *testing.T) { messageContent := ` Test one two three! I go to http://yahoo.com and search for _sports_ and **answers**. Here is an iframe ## blah blah blah [test link](http://owncast.online) ` expected := `
Test one two three! I go to http://yahoo.com and search for sports and answers. Here is an iframe
blah blah blah ` result := models.RenderAndSanitize(messageContent) if result != expected { t.Errorf("message rendering/sanitation does not match expected. Got\n%s, \n\n want:\n%s", result, expected) } }