diff options
Diffstat (limited to 'model/utils_test.go')
-rw-r--r-- | model/utils_test.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/model/utils_test.go b/model/utils_test.go index 7f14bcdf0..aab535fc9 100644 --- a/model/utils_test.go +++ b/model/utils_test.go @@ -17,6 +17,15 @@ func TestNewId(t *testing.T) { } } +func TestRandomString(t *testing.T) { + for i := 0; i < 1000; i++ { + r := NewRandomString(32) + if len(r) != 32 { + t.Fatal("should be 32 chars") + } + } +} + func TestAppError(t *testing.T) { err := NewAppError("TestAppError", "message", "") json := err.ToJson() @@ -47,21 +56,21 @@ func TestMapJson(t *testing.T) { } func TestValidEmail(t *testing.T) { - if !IsValidEmail("corey@hulen.com") { + if !IsValidEmail("corey+test@hulen.com") { t.Error("email should be valid") } - if IsValidEmail("@corey@hulen.com") { + if IsValidEmail("@corey+test@hulen.com") { t.Error("should be invalid") } } func TestValidLower(t *testing.T) { - if !IsLower("corey@hulen.com") { + if !IsLower("corey+test@hulen.com") { t.Error("should be valid") } - if IsLower("Corey@hulen.com") { + if IsLower("Corey+test@hulen.com") { t.Error("should be invalid") } } |