Skip to content

Commit 432d3b1

Browse files
committed
test: fix broken tests due to invite feature
1 parent 8787300 commit 432d3b1

File tree

2 files changed

+188
-122
lines changed

2 files changed

+188
-122
lines changed

apps/meteor/tests/data/rooms.helper.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,32 @@ export const loadHistory = async (
424424
unreadNotLoaded?: number;
425425
};
426426
};
427+
428+
/**
429+
* Accepts a room invite for the authenticated user.
430+
*
431+
* Processes a room invitation by accepting it, which grants the user
432+
* access to the room. This is essential for federated room workflows
433+
* where users receive invitations rather than auto-joining.
434+
*
435+
* @param roomId - The unique identifier of the room
436+
* @param config - Optional request configuration for custom domains
437+
* @returns Promise resolving to the acceptance response
438+
*/
439+
export const acceptRoomInvite = (roomId: IRoom['_id'], config?: IRequestConfig) => {
440+
const requestInstance = config?.request || request;
441+
const credentialsInstance = config?.credentials || credentials;
442+
443+
return new Promise<{ success: boolean }>((resolve) => {
444+
void requestInstance
445+
.post(api('rooms.invite'))
446+
.set(credentialsInstance)
447+
.send({
448+
roomId,
449+
action: 'accept',
450+
})
451+
.end((_err: any, req: any) => {
452+
resolve(req.body);
453+
});
454+
});
455+
};

0 commit comments

Comments
 (0)