Add room state test

This commit is contained in:
nxshock 2019-08-03 11:59:52 +05:00
parent 87144ee37d
commit 4793970e87

View File

@ -17,7 +17,8 @@ func TestCreateRoom(t *testing.T) {
request := createroom.Request{ request := createroom.Request{
RoomAliasName: "room1", RoomAliasName: "room1",
Name: "room1", Name: "room1",
Topic: "topic"} Topic: "topic",
Preset: createroom.PublicChat}
room, err := user.CreateRoom(request) room, err := user.CreateRoom(request)
assert.NoError(t, err) assert.NoError(t, err)
@ -25,6 +26,7 @@ func TestCreateRoom(t *testing.T) {
assert.Equal(t, request.Name, room.Name()) assert.Equal(t, request.Name, room.Name())
assert.Equal(t, request.Topic, room.Topic()) assert.Equal(t, request.Topic, room.Topic())
assert.Equal(t, user.ID(), room.Creator().ID()) assert.Equal(t, user.ID(), room.Creator().ID())
assert.Equal(t, request.Preset, room.State())
assert.Equal(t, 1, len(backend.rooms)) assert.Equal(t, 1, len(backend.rooms))
assert.Equal(t, "!"+room.(*Room).id+":"+backend.hostname, room.ID()) assert.Equal(t, "!"+room.(*Room).id+":"+backend.hostname, room.ID())
} }