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

@ -300,18 +300,14 @@ describe('BrowserView module', () => {
}).to.not.throw();
});
it('can be called on a BrowserView with a destroyed webContents', (done) => {
it('can be called on a BrowserView with a destroyed webContents', async () => {
view = new BrowserView();
w.addBrowserView(view);
view.webContents.on('destroyed', () => {
w.removeBrowserView(view);
done();
});
view.webContents.loadURL('data:text/html,hello there').then(() => {
view.webContents.close();
});
await view.webContents.loadURL('data:text/html,hello there');
const destroyed = once(view.webContents, 'destroyed');
view.webContents.close();
await destroyed;
w.removeBrowserView(view);
});
});