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
|
@ -4,8 +4,8 @@ import * as path from 'path';
|
|||
import { session, webContents, WebContents } from 'electron/main';
|
||||
import { expect } from 'chai';
|
||||
import { v4 } from 'uuid';
|
||||
import { AddressInfo } from 'net';
|
||||
import { emittedOnce, emittedNTimes } from './lib/events-helpers';
|
||||
import { listen } from './lib/spec-helpers';
|
||||
|
||||
const partition = 'service-workers-spec';
|
||||
|
||||
|
@ -32,12 +32,8 @@ describe('session.serviceWorkers', () => {
|
|||
}
|
||||
res.end(fs.readFileSync(path.resolve(__dirname, 'fixtures', 'api', 'service-workers', file)));
|
||||
});
|
||||
await new Promise<void>(resolve => {
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
baseUrl = `http://localhost:${(server.address() as AddressInfo).port}/${uuid}`;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
const { port } = await listen(server);
|
||||
baseUrl = `http://localhost:${port}/${uuid}`;
|
||||
|
||||
w = (webContents as typeof ElectronInternal.WebContents).create({ session: ses });
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue