From c7d1f4f6b2dc028869ba46fbe6c81a01906b3be6 Mon Sep 17 00:00:00 2001 From: Ryohei Ikegami Date: Fri, 31 Jul 2015 14:32:07 +0900 Subject: [PATCH] Add spec for remote Promise --- spec/api-ipc-spec.coffee | 9 +++++++++ spec/fixtures/module/promise.js | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 spec/fixtures/module/promise.js diff --git a/spec/api-ipc-spec.coffee b/spec/api-ipc-spec.coffee index d7f77b14ce2e..04da0026e6bd 100644 --- a/spec/api-ipc-spec.coffee +++ b/spec/api-ipc-spec.coffee @@ -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' diff --git a/spec/fixtures/module/promise.js b/spec/fixtures/module/promise.js new file mode 100644 index 000000000000..a82acc4b11a5 --- /dev/null +++ b/spec/fixtures/module/promise.js @@ -0,0 +1,3 @@ +exports.toPromise = function (value) { + return Promise.resolve(value); +};