@stream-io/video-client 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +4 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Call.ts +2 -2
- package/src/events/__tests__/call.test.ts +30 -0
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -516,7 +516,7 @@ export class Call {
|
|
|
516
516
|
await waitUntilCallJoined();
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
if (this.ringing) {
|
|
519
|
+
if (reject && this.ringing) {
|
|
520
520
|
// I'm the one who started the call, so I should cancel it.
|
|
521
521
|
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
|
|
522
522
|
if (
|
|
@@ -527,7 +527,7 @@ export class Call {
|
|
|
527
527
|
// Signals other users that I have cancelled my call to them
|
|
528
528
|
// before they accepted it.
|
|
529
529
|
await this.reject();
|
|
530
|
-
} else if (
|
|
530
|
+
} else if (callingState === CallingState.RINGING) {
|
|
531
531
|
// Signals other users that I have rejected the incoming call.
|
|
532
532
|
await this.reject();
|
|
533
533
|
}
|
|
@@ -310,6 +310,36 @@ describe('Call ringing events', () => {
|
|
|
310
310
|
expect(call.leave).not.toHaveBeenCalled();
|
|
311
311
|
});
|
|
312
312
|
});
|
|
313
|
+
|
|
314
|
+
describe('call.leave', () => {
|
|
315
|
+
it('should not call reject when leaving under specific conditions', async () => {
|
|
316
|
+
const call = fakeCall();
|
|
317
|
+
call.state.setCallingState(CallingState.JOINED);
|
|
318
|
+
const rejectSpy = vi
|
|
319
|
+
.spyOn(call, 'reject')
|
|
320
|
+
.mockImplementation(async () => {
|
|
321
|
+
console.log('TEST: reject() called');
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
await call.leave({ reject: false });
|
|
325
|
+
|
|
326
|
+
expect(rejectSpy).not.toHaveBeenCalled();
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it('should call reject when leaving while ringing and reject is true', async () => {
|
|
330
|
+
const call = fakeCall();
|
|
331
|
+
call.state.setCallingState(CallingState.RINGING);
|
|
332
|
+
const rejectSpy = vi
|
|
333
|
+
.spyOn(call, 'reject')
|
|
334
|
+
.mockImplementation(async () => {
|
|
335
|
+
console.log('TEST: reject() called');
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
await call.leave({ reject: true });
|
|
339
|
+
|
|
340
|
+
expect(rejectSpy).toHaveBeenCalled();
|
|
341
|
+
});
|
|
342
|
+
});
|
|
313
343
|
});
|
|
314
344
|
|
|
315
345
|
const fakeCall = ({ ring = true, currentUserId = 'test-user-id' } = {}) => {
|