You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Modify RVS test to wait until room loaded
This allows for the alias resolution to occur before a join is attempted. In theory, join_room could in future do an optional view_room-esque thing before attemping a join which would be less fragile than dispatching things in the right order. Also, make sure the store indicates that it is not loading when a room ID has been used - no alias resolution need take place.
This commit is contained in:
@ -45,12 +45,15 @@ describe('RoomViewStore', function() {
|
||||
done();
|
||||
};
|
||||
|
||||
dispatch({ action: 'view_room', room_alias: '#somealias2:aser.ver' });
|
||||
RoomViewStore.addListener(() => {
|
||||
// Wait until the room alias has resolved and the room ID is
|
||||
if (!RoomViewStore.isRoomLoading()) {
|
||||
expect(RoomViewStore.getRoomId()).toBe("!randomcharacters:aser.ver");
|
||||
dispatch({ action: 'join_room' });
|
||||
expect(RoomViewStore.isJoining()).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for the next event loop to allow for room alias resolution
|
||||
setTimeout(() => {
|
||||
dispatch({ action: 'join_room' });
|
||||
expect(RoomViewStore.isJoining()).toBe(true);
|
||||
}, 0);
|
||||
dispatch({ action: 'view_room', room_alias: '#somealias2:aser.ver' });
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user