Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/framework/presence/src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ export type ProcessSignalFunction = ReturnType<typeof createPresenceManager>["pr
* @param attendeeId - the client session id given to presence
* @param clientConnectionId - the client connection id
* @param clock - the fake timer.
* @param logger - optional logger to track telemetry events
* @param logger - logger to track telemetry events
*/
export function prepareConnectedPresence(
runtime: MockEphemeralRuntime,
attendeeId: string,
clientConnectionId: ClientConnectionId,
clock: Omit<SinonFakeTimers, "restore">,
logger?: EventAndErrorTrackingLogger,
logger: EventAndErrorTrackingLogger,
): {
presence: PresenceWithNotifications;
processSignal: ProcessSignalFunction;
Expand All @@ -154,7 +154,7 @@ export function prepareConnectedPresence(
runtime.clientId = clientConnectionId;
runtime.joined = true;

logger?.registerExpectedEvent({ eventName: "Presence:PresenceInstantiated" });
logger.registerExpectedEvent({ eventName: "Presence:PresenceInstantiated" });

// This logic needs to be kept in sync with datastore manager.
// From PresenceDatastoreManager.getInteractiveMembersExcludingSelf:
Expand Down Expand Up @@ -201,6 +201,7 @@ export function prepareConnectedPresence(
// the network and Presence can safely mutate it.
presence.processSignal(
addressChain,
// eslint-disable-next-line unicorn/prefer-structured-clone -- not structural clone, but filters to JSON-serializable data
JSON.parse(JSON.stringify(signalMessage)) as InboundExtensionMessage<SignalMessages>,
local,
);
Expand Down Expand Up @@ -255,7 +256,7 @@ export function prepareConnectedPresence(
*/
export function assertFinalExpectations(
runtime: MockEphemeralRuntime,
logger?: EventAndErrorTrackingLogger,
logger: EventAndErrorTrackingLogger,
): void {
// Make sure all expected events were logged and there are no unexpected errors.
const logErrors = getUnexpectedLogErrorException(logger);
Expand Down
Loading