Change spec to test Promise in both side
This commit is contained in:
parent
92af275f98
commit
428ad20807
2 changed files with 8 additions and 7 deletions
|
@ -52,11 +52,10 @@ 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) ->
|
||||
describe 'remote promise', ->
|
||||
it 'can be used as promise in each side', (done) ->
|
||||
promise = remote.require path.join(fixtures, 'module', 'promise.js')
|
||||
promise.toPromise(1234)
|
||||
.then (value) => value * 2
|
||||
promise.twicePromise(Promise.resolve(1234))
|
||||
.then (value) =>
|
||||
assert.equal value, 2468
|
||||
done()
|
||||
|
|
8
spec/fixtures/module/promise.js
vendored
8
spec/fixtures/module/promise.js
vendored
|
@ -1,3 +1,5 @@
|
|||
exports.toPromise = function (value) {
|
||||
return Promise.resolve(value);
|
||||
};
|
||||
exports.twicePromise = function (promise) {
|
||||
return promise.then(function (value) {
|
||||
return value * 2;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue