Remove use of getView() and replace with getViewByURL() where necessary. (#2544)

* WIP

* Replace getView with getViewByURL
This commit is contained in:
Devin Binnie
2023-02-07 08:59:35 -05:00
committed by GitHub
parent 8babd52b81
commit 07e41ec678
14 changed files with 254 additions and 350 deletions

View File

@@ -153,6 +153,7 @@ jest.mock('main/windows/windowManager', () => ({
sendToMattermostViews: jest.fn(),
sendToRenderer: jest.fn(),
getServerNameByWebContentsId: jest.fn(),
getServerURLFromWebContentsId: jest.fn(),
}));
describe('main/app/initialize', () => {
beforeEach(() => {
@@ -237,6 +238,7 @@ describe('main/app/initialize', () => {
});
it('should allow permission requests for supported types from trusted URLs', async () => {
WindowManager.getServerURLFromWebContentsId.mockReturnValue(new URL('http://server-1.com'));
let callback = jest.fn();
session.defaultSession.setPermissionRequestHandler.mockImplementation((cb) => {
cb({id: 1, getURL: () => 'http://server-1.com'}, 'bad-permission', callback);