mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
This commit is contained in:
@@ -508,4 +508,22 @@ describe('remote module', () => {
|
||||
w.loadURL('about:blank')
|
||||
})
|
||||
})
|
||||
|
||||
describe('with an overriden global Promise constrctor', () => {
|
||||
let original
|
||||
|
||||
before(() => {
|
||||
original = Promise
|
||||
})
|
||||
|
||||
it('using a promise based method resolves correctly', async () => {
|
||||
expect(await remote.getGlobal('returnAPromise')(123)).to.equal(123)
|
||||
global.Promise = { resolve: () => ({}) }
|
||||
expect(await remote.getGlobal('returnAPromise')(456)).to.equal(456)
|
||||
})
|
||||
|
||||
after(() => {
|
||||
global.Promise = original
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -72,6 +72,7 @@ ipcMain.on('echo', function (event, msg) {
|
||||
})
|
||||
|
||||
global.setTimeoutPromisified = util.promisify(setTimeout)
|
||||
global.returnAPromise = (value) => new Promise((resolve) => setTimeout(() => resolve(value), 100))
|
||||
|
||||
global.permissionChecks = {
|
||||
allow: () => electron.session.defaultSession.setPermissionCheckHandler(null),
|
||||
|
||||
Reference in New Issue
Block a user