MM-52857 - Add call-join-request to calls widget (#2751)

* add call-join-request to calls widget

* targetID -> callID

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Christopher Poile
2023-06-26 10:17:47 -04:00
committed by GitHub
parent 850573326c
commit 0728ddf42f
6 changed files with 71 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ import {BrowserWindow, desktopCapturer, systemPreferences} from 'electron';
import ServerViewState from 'app/serverViewState';
import {CALLS_WIDGET_SHARE_SCREEN, CALLS_JOINED_CALL} from 'common/communication';
import {CALLS_WIDGET_SHARE_SCREEN, CALLS_JOINED_CALL, CALLS_JOIN_REQUEST} from 'common/communication';
import {
MINIMUM_CALLS_WIDGET_WIDTH,
MINIMUM_CALLS_WIDGET_HEIGHT,
@@ -958,4 +958,35 @@ describe('main/windows/callsWidgetWindow', () => {
expect(handler).toHaveBeenCalledTimes(1);
});
});
describe('handleCallsJoinRequest', () => {
const view = {
view: {
server: {
id: 'server-1',
},
},
sendToRenderer: jest.fn(),
};
const callsWidgetWindow = new CallsWidgetWindow();
callsWidgetWindow.mainView = view;
const focus = jest.fn();
beforeEach(() => {
MainWindow.get.mockReturnValue({focus});
ViewManager.getView.mockReturnValue(view);
});
afterEach(() => {
jest.resetAllMocks();
});
it('should pass through the join call callID to the webapp', () => {
callsWidgetWindow.handleCallsJoinRequest('', {callID: 'thecallchannelid'});
expect(ServerViewState.switchServer).toHaveBeenCalledWith('server-1');
expect(focus).toHaveBeenCalled();
expect(view.sendToRenderer).toBeCalledWith(CALLS_JOIN_REQUEST, {callID: 'thecallchannelid'});
});
});
});