From 38f9c25b1b36aae62ce7fadab017fb7434ee21d1 Mon Sep 17 00:00:00 2001 From: nxshock Date: Mon, 22 Jul 2019 22:29:18 +0500 Subject: [PATCH] Add test of room user count --- internal/backends/memory/rooms_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/backends/memory/rooms_test.go b/internal/backends/memory/rooms_test.go index ea0029a..5c31cf2 100644 --- a/internal/backends/memory/rooms_test.go +++ b/internal/backends/memory/rooms_test.go @@ -103,3 +103,21 @@ func TestLeaveRoom(t *testing.T) { err = user.LeaveRoom(room) assert.NotNil(t, err) } + +func TestRoomUserCount(t *testing.T) { + backend := NewBackend("localhost") + + user1, _, err := backend.Register("user1", "", "") + assert.Nil(t, err) + + request := createroom.Request{ + RoomAliasName: "room1", + Name: "room1", + Topic: "topic"} + + room, err := user1.CreateRoom(request) + assert.Nil(t, err) + assert.Len(t, room.Users(), 1) + + // TODO: add join another user test +}