FakeRoomFactory

A test double for RoomFactory that returns FakeRoom instances.

host seeds the room's FakeRoom.selfId from the pattern's session name and sets the role to SessionRole.Host. join does the same with SessionRole.Joiner.

For wired two-room scenarios, prefer fakeRoomPair.

val factory = FakeRoomFactory()
val room = factory.host(Pattern("alice"))
// room.selfId == PeerId("alice"), room.role.value == SessionRole.Host

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open suspend override fun host(pattern: Pattern, memberName: String?, roomId: RoomId?): Room

roomId is honoured verbatim when supplied; otherwise a fresh one is minted per call, so two rooms hosted under the same session name never share an identity — the same contract the real factory keeps (#1594).

Link copied to clipboard
open suspend override fun join(tag: Tag, memberName: String?): Room

A joiner has no room id until it is admitted; drive that with FakeRoom.setRoomId.