import type { Room, RoomLifecycle, RoomOptions, RoomStatus } from '@ably/chat'; import { RoomOptionsDefaults } from '@ably/chat'; import { vi } from 'vitest'; import { PublicChatClient } from '../unified-clients/RpcChat'; import { randomRoomId } from './identifier'; // Wait 3 seconds for the room to reach the expected status export const waitForRoomStatus = async (status: RoomStatus, expected: RoomLifecycle) => { return vi.waitUntil(() => status.current === expected, 3000); }; // Gets a random room with default options from the chat client export const getRandomRoom = (chat: PublicChatClient): Room => chat.rooms.get(randomRoomId(), defaultRoomOptions); // Return a default set of room options export const defaultRoomOptions: RoomOptions = { ...RoomOptionsDefaults, };