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')
|
print_name = remote.require path.join(fixtures, 'module', 'print_name.js')
|
||||||
assert.equal print_name.print(buf), 'Buffer'
|
assert.equal print_name.print(buf), 'Buffer'
|
||||||
|
|
||||||
describe 'remote promise in renderer', ->
|
describe 'remote promise', ->
|
||||||
it 'can be used as promise', (done) ->
|
it 'can be used as promise in each side', (done) ->
|
||||||
promise = remote.require path.join(fixtures, 'module', 'promise.js')
|
promise = remote.require path.join(fixtures, 'module', 'promise.js')
|
||||||
promise.toPromise(1234)
|
promise.twicePromise(Promise.resolve(1234))
|
||||||
.then (value) => value * 2
|
|
||||||
.then (value) =>
|
.then (value) =>
|
||||||
assert.equal value, 2468
|
assert.equal value, 2468
|
||||||
done()
|
done()
|
||||||
|
|
8
spec/fixtures/module/promise.js
vendored
8
spec/fixtures/module/promise.js
vendored
|
@ -1,3 +1,5 @@
|
||||||
exports.toPromise = function (value) {
|
exports.twicePromise = function (promise) {
|
||||||
return Promise.resolve(value);
|
return promise.then(function (value) {
|
||||||
};
|
return value * 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue