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:
parent
e5b61f0632
commit
40748d3c94
4 changed files with 22 additions and 24 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue