Add test case for short username

This commit is contained in:
nxshock 2019-08-06 18:59:28 +05:00
parent ab108855c4
commit febdc5f31f

View File

@ -177,3 +177,14 @@ func TestPublicRooms(t *testing.T) {
assert.Equal(t, rooms[0], room2) assert.Equal(t, rooms[0], room2)
assert.Equal(t, rooms[1], room1) assert.Equal(t, rooms[1], room1)
} }
func TestNewUserNameValidate(t *testing.T) {
backend := NewBackend("localhost")
var shortName = "u1"
user, token, err := backend.Register(shortName, "", "")
assert.Error(t, err)
assert.Nil(t, user)
assert.Empty(t, token)
}