Live location share - explicitly stop beacons replaced beacons (PSG-544) (#8933)
* explicitly stop beacons before creating new ones * remove unnecessary optional chain
This commit is contained in:
parent
d439871ea1
commit
4eab0deeb3
3 changed files with 37 additions and 2 deletions
|
@ -78,6 +78,7 @@ describe('<LocationShareMenu />', () => {
|
|||
}),
|
||||
sendMessage: jest.fn(),
|
||||
unstable_createLiveBeacon: jest.fn().mockResolvedValue({ event_id: '1' }),
|
||||
unstable_setLiveBeacon: jest.fn().mockResolvedValue({ event_id: '1' }),
|
||||
getVisibleRooms: jest.fn().mockReturnValue([]),
|
||||
});
|
||||
|
||||
|
@ -386,7 +387,7 @@ describe('<LocationShareMenu />', () => {
|
|||
expect(getShareTypeOption(component, LocationShareType.Live).length).toBeFalsy();
|
||||
});
|
||||
|
||||
it('creates beacon info event on submission', () => {
|
||||
it('creates beacon info event on submission', async () => {
|
||||
const onFinished = jest.fn();
|
||||
const component = getComponent({ onFinished });
|
||||
|
||||
|
@ -399,6 +400,9 @@ describe('<LocationShareMenu />', () => {
|
|||
component.setProps({});
|
||||
});
|
||||
|
||||
// flush stopping existing beacons promises
|
||||
await flushPromisesWithFakeTimers();
|
||||
|
||||
expect(onFinished).toHaveBeenCalled();
|
||||
const [eventRoomId, eventContent] = mockClient.unstable_createLiveBeacon.mock.calls[0];
|
||||
expect(eventRoomId).toEqual(defaultProps.roomId);
|
||||
|
@ -429,6 +433,7 @@ describe('<LocationShareMenu />', () => {
|
|||
component.setProps({});
|
||||
});
|
||||
|
||||
await flushPromisesWithFakeTimers();
|
||||
await flushPromisesWithFakeTimers();
|
||||
await flushPromisesWithFakeTimers();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue