You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
496 B

package utils
import (
"testing"
mevt "maunium.net/go/mautrix/event"
)
func TestHTMLStrip(t *testing.T) {
msg := `before &lt;<hello a="b"><inside />during</hello>&gt; after`
stripped := StrippedHTMLMessage(mevt.MsgNotice, msg)
if stripped.MsgType != mevt.MsgNotice {
t.Fatalf("Expected MsgType %v, got %v", mevt.MsgNotice, stripped.MsgType)
}
expected := "before <during> after"
if stripped.Body != expected {
t.Fatalf(`Expected Body "%v", got "%v"`, expected, stripped.Body)
}
}