Make CallHandler emit CallChangeRoom

Let's hope I changed the tests correctly

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-04-28 11:49:07 +02:00
parent e5b61f0632
commit 40748d3c94
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
4 changed files with 22 additions and 24 deletions

View file

@ -16,7 +16,7 @@ limitations under the License.
import './skinned-sdk';
import CallHandler, { PlaceCallType } from '../src/CallHandler';
import CallHandler, { PlaceCallType, CallHandlerEvent } from '../src/CallHandler';
import { stubClient, mkStubRoom } from './test-utils';
import { MatrixClientPeg } from '../src/MatrixClientPeg';
import dis from '../src/dispatcher/dispatcher';
@ -172,11 +172,9 @@ describe('CallHandler', () => {
let callRoomChangeEventCount = 0;
const roomChangePromise = new Promise<void>(resolve => {
dispatchHandle = dis.register(payload => {
if (payload.action === Action.CallChangeRoom) {
++callRoomChangeEventCount;
resolve();
}
CallHandler.sharedInstance().addListener(CallHandlerEvent.CallChangeRoom, () => {
++callRoomChangeEventCount;
resolve();
});
});
@ -202,6 +200,7 @@ describe('CallHandler', () => {
await roomChangePromise;
dis.unregister(dispatchHandle);
CallHandler.sharedInstance().removeAllListeners();
// If everything's gone well, we should have seen only one room change
// event and the call should now be in user 3's room.