test: convert functions to async & eliminate duplicates (#37316)
test: convert functions to async Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
parent
969665eaa2
commit
f97d68c4bf
24 changed files with 225 additions and 343 deletions
|
@ -9,7 +9,7 @@ import * as cp from 'child_process';
|
|||
|
||||
import { closeWindow } from './lib/window-helpers';
|
||||
import { emittedOnce } from './lib/events-helpers';
|
||||
import { AddressInfo } from 'net';
|
||||
import { listen } from './lib/spec-helpers';
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'context-bridge');
|
||||
|
||||
|
@ -17,13 +17,14 @@ describe('contextBridge', () => {
|
|||
let w: BrowserWindow;
|
||||
let dir: string;
|
||||
let server: http.Server;
|
||||
let serverUrl: string;
|
||||
|
||||
before(async () => {
|
||||
server = http.createServer((req, res) => {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end('');
|
||||
});
|
||||
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve));
|
||||
serverUrl = (await listen(server)).url;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
|
@ -95,7 +96,7 @@ describe('contextBridge', () => {
|
|||
additionalArguments: ['--unsafely-expose-electron-internals-for-testing']
|
||||
}
|
||||
});
|
||||
await w.loadURL(`http://127.0.0.1:${(server.address() as AddressInfo).port}`);
|
||||
await w.loadURL(serverUrl);
|
||||
};
|
||||
|
||||
const callWithBindings = (fn: Function, worldId: number = 0) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue