summaryrefslogtreecommitdiffstats
path: root/model/user_test.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-02-06 17:25:53 +0000
committerGeorge Goldberg <george@gberg.me>2018-02-06 17:25:53 +0000
commit7941c30117efe1b957ac0458c2f0479e3824196d (patch)
treedf791632a9dc790a6f73dec53aae3ba919ebda63 /model/user_test.go
parente1cd64613591cf5a990442a69ebf188258bd0cb5 (diff)
parent034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff)
downloadchat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.gz
chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.bz2
chat-7941c30117efe1b957ac0458c2f0479e3824196d.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/user_test.go')
-rw-r--r--model/user_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/model/user_test.go b/model/user_test.go
index 5f97b3ff2..72ad6a92b 100644
--- a/model/user_test.go
+++ b/model/user_test.go
@@ -243,6 +243,30 @@ func TestValidUsername(t *testing.T) {
}
}
+func TestNormalizeUsername(t *testing.T) {
+ if NormalizeUsername("Spin-punch") != "spin-punch" {
+ t.Fatal("didn't normalize username properly")
+ }
+ if NormalizeUsername("PUNCH") != "punch" {
+ t.Fatal("didn't normalize username properly")
+ }
+ if NormalizeUsername("spin") != "spin" {
+ t.Fatal("didn't normalize username properly")
+ }
+}
+
+func TestNormalizeEmail(t *testing.T) {
+ if NormalizeEmail("TEST@EXAMPLE.COM") != "test@example.com" {
+ t.Fatal("didn't normalize email properly")
+ }
+ if NormalizeEmail("TEST2@example.com") != "test2@example.com" {
+ t.Fatal("didn't normalize email properly")
+ }
+ if NormalizeEmail("test3@example.com") != "test3@example.com" {
+ t.Fatal("didn't normalize email properly")
+ }
+}
+
func TestCleanUsername(t *testing.T) {
if CleanUsername("Spin-punch") != "spin-punch" {
t.Fatal("didn't clean name properly")