test: convert a few more specs to async/await (#39712)

This commit is contained in:
Milan Burda 2023-09-04 12:33:29 +02:00 committed by GitHub
parent 54d8402a6c
commit f27b034045
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 70 additions and 89 deletions

View file

@ -7,7 +7,7 @@ import * as fs from 'node:fs';
import * as url from 'node:url';
import * as WebSocket from 'ws';
import { ipcMain, protocol, session, WebContents, webContents } from 'electron/main';
import { AddressInfo, Socket } from 'node:net';
import { Socket } from 'node:net';
import { listen, defer } from './lib/spec-helpers';
import { once } from 'node:events';
import { ReadableStream } from 'node:stream/web';
@ -60,10 +60,7 @@ describe('webRequest module', () => {
before(async () => {
protocol.registerStringProtocol('cors', (req, cb) => cb(''));
defaultURL = (await listen(server)).url + '/';
await new Promise<void>((resolve) => {
h2server.listen(0, '127.0.0.1', () => resolve());
});
http2URL = `https://127.0.0.1:${(h2server.address() as AddressInfo).port}/`;
http2URL = (await listen(h2server)).url + '/';
console.log(http2URL);
});