summaryrefslogtreecommitdiffstats
path: root/bridge/matrix/matrix_test.go
diff options
context:
space:
mode:
authorDellle <39235395+Dellle@users.noreply.github.com>2020-10-20 21:22:31 +0200
committerGitHub <noreply@github.com>2020-10-20 21:22:31 +0200
commit3188a9ffe6b91932252ec0b71e74e82b4a54eee1 (patch)
treedbb1716e2957061ab2398a6dacaa96ad9af5dba5 /bridge/matrix/matrix_test.go
parent61569a8610206a04a7a139924e6d135de8c4fdf3 (diff)
downloadmatterbridge-msglm-3188a9ffe6b91932252ec0b71e74e82b4a54eee1.tar.gz
matterbridge-msglm-3188a9ffe6b91932252ec0b71e74e82b4a54eee1.tar.bz2
matterbridge-msglm-3188a9ffe6b91932252ec0b71e74e82b4a54eee1.zip
Add username formatting for all events (matrix) (#1233)
Diffstat (limited to 'bridge/matrix/matrix_test.go')
-rw-r--r--bridge/matrix/matrix_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/bridge/matrix/matrix_test.go b/bridge/matrix/matrix_test.go
new file mode 100644
index 00000000..846d9a43
--- /dev/null
+++ b/bridge/matrix/matrix_test.go
@@ -0,0 +1,28 @@
+package bmatrix
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestPlainUsername(t *testing.T) {
+ uut := newMatrixUsername("MyUser")
+
+ assert.Equal(t, "MyUser", uut.formatted)
+ assert.Equal(t, "MyUser", uut.plain)
+}
+
+func TestHTMLUsername(t *testing.T) {
+ uut := newMatrixUsername("<b>MyUser</b>")
+
+ assert.Equal(t, "<b>MyUser</b>", uut.formatted)
+ assert.Equal(t, "MyUser", uut.plain)
+}
+
+func TestFancyUsername(t *testing.T) {
+ uut := newMatrixUsername("<MyUser>")
+
+ assert.Equal(t, "&lt;MyUser&gt;", uut.formatted)
+ assert.Equal(t, "<MyUser>", uut.plain)
+}