test: rename & split internal module tests (#37318)
This commit is contained in:
parent
73b7aac6a4
commit
0a5e634736
3 changed files with 21 additions and 21 deletions
44
spec/process-binding-spec.ts
Normal file
44
spec/process-binding-spec.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { expect } from 'chai';
|
||||
import { BrowserWindow } from 'electron/main';
|
||||
import { closeAllWindows } from './lib/window-helpers';
|
||||
|
||||
describe('process._linkedBinding', () => {
|
||||
describe('in the main process', () => {
|
||||
it('can access electron_browser bindings', () => {
|
||||
process._linkedBinding('electron_browser_app');
|
||||
});
|
||||
|
||||
it('can access electron_common bindings', () => {
|
||||
process._linkedBinding('electron_common_v8_util');
|
||||
});
|
||||
|
||||
it('cannot access electron_renderer bindings', () => {
|
||||
expect(() => {
|
||||
process._linkedBinding('electron_renderer_ipc');
|
||||
}).to.throw(/No such binding was linked: electron_renderer_ipc/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('in the renderer process', () => {
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
it('cannot access electron_browser bindings', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
await expect(w.webContents.executeJavaScript('void process._linkedBinding(\'electron_browser_app\')'))
|
||||
.to.eventually.be.rejectedWith(/Script failed to execute/);
|
||||
});
|
||||
|
||||
it('can access electron_common bindings', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript('void process._linkedBinding(\'electron_common_v8_util\')');
|
||||
});
|
||||
|
||||
it('can access electron_renderer bindings', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript('void process._linkedBinding(\'electron_renderer_ipc\')');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue