From 3188a9ffe6b91932252ec0b71e74e82b4a54eee1 Mon Sep 17 00:00:00 2001
From: Dellle <39235395+Dellle@users.noreply.github.com>
Date: Tue, 20 Oct 2020 21:22:31 +0200
Subject: Add username formatting for all events (matrix) (#1233)
---
bridge/matrix/matrix_test.go | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 bridge/matrix/matrix_test.go
(limited to 'bridge/matrix/matrix_test.go')
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("MyUser")
+
+ assert.Equal(t, "MyUser", uut.formatted)
+ assert.Equal(t, "MyUser", uut.plain)
+}
+
+func TestFancyUsername(t *testing.T) {
+ uut := newMatrixUsername("")
+
+ assert.Equal(t, "<MyUser>", uut.formatted)
+ assert.Equal(t, "", uut.plain)
+}
--
cgit v1.2.3