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

  1. package utils
  2. import (
  3. "testing"
  4. mevt "maunium.net/go/mautrix/event"
  5. )
  6. func TestHTMLStrip(t *testing.T) {
  7. msg := `before &lt;<hello a="b"><inside />during</hello>&gt; after`
  8. stripped := StrippedHTMLMessage(mevt.MsgNotice, msg)
  9. if stripped.MsgType != mevt.MsgNotice {
  10. t.Fatalf("Expected MsgType %v, got %v", mevt.MsgNotice, stripped.MsgType)
  11. }
  12. expected := "before <during> after"
  13. if stripped.Body != expected {
  14. t.Fatalf(`Expected Body "%v", got "%v"`, expected, stripped.Body)
  15. }
  16. }