promisified-dbus-native
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "promisified-dbus-native", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "promisified dbus-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
56
test.js
@@ -0,15 +1,49 @@ | ||
const assert = require('assert'); | ||
const dbus = require('./'); | ||
const originalDbus = require('dbus-native'); | ||
(async function() { | ||
function introspect0() { | ||
return new Promise((resolve, reject) => { | ||
originalDbus.systemBus().getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable', (err, iface) => { | ||
err ? reject(err) : iface.Introspect((err, result) => { | ||
err ? reject(err) : resolve(result); | ||
}) | ||
}); | ||
}); | ||
} | ||
function introspect1() { | ||
return dbus.systemBus() | ||
.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable') | ||
.then(iface => iface.Introspect()) | ||
} | ||
async function introspect2() { | ||
const bus = dbus.systemBus(); | ||
const service = await bus.getService('org.freedesktop.DBus'); | ||
let obj = await service.getObject('/org/freedesktop/DBus'); | ||
let iface = await obj.as('org.freedesktop.DBus.Introspectable'); | ||
let result = await iface.Introspect(); | ||
console.log(result); | ||
const service = bus.getService('org.freedesktop.DBus'); | ||
const obj = await service.getObject('/org/freedesktop/DBus'); | ||
const iface = obj.as('org.freedesktop.DBus.Introspectable'); | ||
const result = await iface.Introspect(); | ||
return result; | ||
} | ||
obj = await bus.getObject('org.freedesktop.DBus', '/org/freedesktop/DBus'); | ||
iface = await bus.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable'); | ||
result = await iface.Introspect(); | ||
console.log(result); | ||
})(); | ||
async function introspect3() { | ||
const bus = dbus.systemBus(); | ||
const obj = await bus.getObject('org.freedesktop.DBus', '/org/freedesktop/DBus'); | ||
const iface = await bus.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable'); | ||
const result = await iface.Introspect(); | ||
return result; | ||
} | ||
async function run() { | ||
const expected = await introspect0(); | ||
let [actual1] = await introspect1(); | ||
assert.strictEqual(expected, actual1); | ||
let [actual2] = await introspect2(); | ||
assert.strictEqual(expected, actual2); | ||
let [actual3] = await introspect3(); | ||
assert.strictEqual(expected, actual3); | ||
console.log('ok'); | ||
} | ||
run(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
6161
6
127
1
18