test: use node helpers for events.once and setTimeout promise (#37374)
This commit is contained in:
parent
46c8b9c728
commit
a3e3efe4c4
47 changed files with 932 additions and 927 deletions
|
@ -1,8 +1,8 @@
|
|||
import { expect } from 'chai';
|
||||
import * as path from 'path';
|
||||
import { BrowserWindow, ipcMain, WebContents } from 'electron/main';
|
||||
import { emittedOnce } from './lib/events-helpers';
|
||||
import { defer } from './lib/spec-helpers';
|
||||
import { once } from 'events';
|
||||
|
||||
describe('webFrame module', () => {
|
||||
const fixtures = path.resolve(__dirname, 'fixtures');
|
||||
|
@ -17,7 +17,7 @@ describe('webFrame module', () => {
|
|||
}
|
||||
});
|
||||
defer(() => w.close());
|
||||
const isSafe = emittedOnce(ipcMain, 'executejs-safe');
|
||||
const isSafe = once(ipcMain, 'executejs-safe');
|
||||
w.loadURL('about:blank');
|
||||
const [, wasSafe] = await isSafe;
|
||||
expect(wasSafe).to.equal(true);
|
||||
|
@ -33,7 +33,7 @@ describe('webFrame module', () => {
|
|||
}
|
||||
});
|
||||
defer(() => w.close());
|
||||
const execError = emittedOnce(ipcMain, 'executejs-safe');
|
||||
const execError = once(ipcMain, 'executejs-safe');
|
||||
w.loadURL('about:blank');
|
||||
const [, error] = await execError;
|
||||
expect(error).to.not.equal(null, 'Error should not be null');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue