Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <hello@internxt.com>",
"version": "1.16.4",
"version": "1.17.0",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/meet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export class Meet {
return this.client.post<JoinCallResponse>(`call/${callId}/users/join`, { ...payload }, headers);
}

async leaveCall(callId: string, payload?: LeaveCallPayload): Promise<void> {
async leaveCall(callId: string, payload: LeaveCallPayload): Promise<void> {
const headers = this.apiSecurity?.token ? this.headersWithToken() : this.basicHeaders();

return this.client.postWithKeepAlive<void>(`call/${callId}/users/leave`, payload ? { ...payload } : {}, headers);
return this.client.postWithKeepAlive<void>(`call/${callId}/users/leave`, { ...payload }, headers);
}

async getCurrentUsersInCall(callId: string): Promise<UsersInCallResponse[]> {
Expand Down
24 changes: 0 additions & 24 deletions test/drive/meet/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,30 +137,6 @@ describe('Meet service tests', () => {
describe('leaveCall method', () => {
const callId = 'call-123';

it('should leave a call successfully with token and no payload', async () => {
// Arrange
const { client, headers } = clientAndHeadersWithToken();
const postCall = vi.spyOn(HttpClient.prototype, 'postWithKeepAlive').mockResolvedValue(undefined);

// Act
await client.leaveCall(callId);

// Assert
expect(postCall).toHaveBeenCalledWith(`call/${callId}/users/leave`, {}, headers);
});

it('should leave a call successfully without token and no payload', async () => {
// Arrange
const { client, headers } = clientAndHeadersWithoutToken();
const postCall = vi.spyOn(HttpClient.prototype, 'postWithKeepAlive').mockResolvedValue(undefined);

// Act
await client.leaveCall(callId);

// Assert
expect(postCall).toHaveBeenCalledWith(`call/${callId}/users/leave`, {}, headers);
});

it('should send userId in body when anonymous user leaves with token', async () => {
const payload: LeaveCallPayload = { userId: 'anon-uuid-456' };
const { client, headers } = clientAndHeadersWithToken();
Expand Down
Loading