mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Add spec for remote Promise
This commit is contained in:
@@ -52,6 +52,15 @@ describe 'ipc module', ->
|
||||
print_name = remote.require path.join(fixtures, 'module', 'print_name.js')
|
||||
assert.equal print_name.print(buf), 'Buffer'
|
||||
|
||||
describe 'remote promise in renderer', ->
|
||||
it 'can be used as promise', (done) ->
|
||||
promise = remote.require path.join(fixtures, 'module', 'promise.js')
|
||||
promise.toPromise(1234)
|
||||
.then (value) => value * 2
|
||||
.then (value) =>
|
||||
assert.equal value, 2468
|
||||
done()
|
||||
|
||||
describe 'ipc.sender.send', ->
|
||||
it 'should work when sending an object containing id property', (done) ->
|
||||
obj = id: 1, name: 'ly'
|
||||
|
||||
3
spec/fixtures/module/promise.js
vendored
Normal file
3
spec/fixtures/module/promise.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
exports.toPromise = function (value) {
|
||||
return Promise.resolve(value);
|
||||
};
|
||||
Reference in New Issue
Block a user