summaryrefslogtreecommitdiff
path: root/installed-tests/js/testGDBus.js
diff options
context:
space:
mode:
Diffstat (limited to 'installed-tests/js/testGDBus.js')
-rw-r--r--installed-tests/js/testGDBus.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/installed-tests/js/testGDBus.js b/installed-tests/js/testGDBus.js
index fd1bb15b..25de96b6 100644
--- a/installed-tests/js/testGDBus.js
+++ b/installed-tests/js/testGDBus.js
@@ -342,6 +342,14 @@ describe('Exported DBus object', function () {
expect(hello.deepUnpack()).toEqual('world');
});
+ it('can initiate a proxy with promise and call a method with async/await', async function () {
+ const asyncProxy = await ProxyClass.newAsync(Gio.DBus.session,
+ 'org.gnome.gjs.Test', '/org/gnome/gjs/Test');
+ expect(asyncProxy).toBeInstanceOf(Gio.DBusProxy);
+ const [{hello}] = await asyncProxy.frobateStuffAsync({});
+ expect(hello.deepUnpack()).toEqual('world');
+ });
+
it('can call a remote method when not using makeProxyWrapper', function () {
let info = Gio.DBusNodeInfo.new_for_xml(TestIface);
let iface = info.interfaces[0];
@@ -918,6 +926,20 @@ describe('DBus Proxy wrapper', function () {
expect(writerFunc).not.toHaveBeenCalled();
});
+ it('can create a proxy from a promise', async function () {
+ const proxyPromise = ProxyClass.newAsync(Gio.DBus.session, 'org.gnome.gjs.Test',
+ '/org/gnome/gjs/Test');
+ await expectAsync(proxyPromise).toBeResolved();
+ });
+
+ it('can create fail a proxy from a promise', async function () {
+ const cancellable = new Gio.Cancellable();
+ cancellable.cancel();
+ const proxyPromise = ProxyClass.newAsync(Gio.DBus.session, 'org.gnome.gjs.Test',
+ '/org/gnome/gjs/Test', cancellable);
+ await expectAsync(proxyPromise).toBeRejected();
+ });
+
afterAll(function () {
if (!wasPromise) {
// Remove stuff added by Gio._promisify, this can be not needed in future