From cdadcfe898df0b6c8fab3dbcbb1b4936410a4014 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 4 Apr 2019 11:16:22 -0400 Subject: [PATCH] Update to dbus-next 0.5.1 The `connection` member of the bus has been made private. Errors are forwarded to the bus itself. Use the new `disconnect()` method to diconnect from the bus during testing. --- package.json | 2 +- src/index.js | 2 +- test/multiple-instances.test.js | 6 +++--- test/player.test.js | 4 ++-- test/playlists.test.js | 4 ++-- test/root.test.js | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index e50371b..7551d50 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ }, "homepage": "https://github.com/emersion/mpris-service", "dependencies": { - "dbus-next": "^0.4.2", + "dbus-next": "^0.5.1", "deep-equal": "^1.0.1", "source-map-support": "^0.5.9" }, diff --git a/src/index.js b/src/index.js index 2073f79..3a878cf 100644 --- a/src/index.js +++ b/src/index.js @@ -182,7 +182,7 @@ Player.prototype.init = function(opts) { this._bus = dbus.sessionBus(); - this._bus.connection.on('error', (err) => { + this._bus.on('error', (err) => { this.emit('error', err); }); diff --git a/test/multiple-instances.test.js b/test/multiple-instances.test.js index d85cb22..0800960 100644 --- a/test/multiple-instances.test.js +++ b/test/multiple-instances.test.js @@ -33,9 +33,9 @@ player2.on('error', errorHandler); let bus = dbus.sessionBus(); afterAll(() => { - player1._bus.connection.stream.end(); - player2._bus.connection.stream.end(); - bus.connection.stream.end(); + player1._bus.disconnect(); + player2._bus.disconnect(); + bus.disconnect(); }); test('creating two players with the same name on the same bus should create the second one as an instance', async () => { diff --git a/test/player.test.js b/test/player.test.js index 83ad0fe..2b090c4 100644 --- a/test/player.test.js +++ b/test/player.test.js @@ -28,8 +28,8 @@ player.on('error', (err) => { let bus = dbus.sessionBus(); afterAll(() => { - player._bus.connection.stream.end(); - bus.connection.stream.end(); + player._bus.disconnect(); + bus.disconnect(); }); test('creating a player exports the root and player interfaces on the bus', async () => { diff --git a/test/playlists.test.js b/test/playlists.test.js index c9588d0..900676a 100644 --- a/test/playlists.test.js +++ b/test/playlists.test.js @@ -27,8 +27,8 @@ player.on('error', (err) => { let bus = dbus.sessionBus(); afterAll(() => { - player._bus.connection.stream.end(); - bus.connection.stream.end(); + player._bus.disconnect(); + bus.disconnect(); }); test('creating a player exports the playlists interfaces on the bus', async () => { diff --git a/test/root.test.js b/test/root.test.js index 52179e7..9bbcdd4 100644 --- a/test/root.test.js +++ b/test/root.test.js @@ -25,13 +25,13 @@ player.on('error', (err) => { let bus = dbus.sessionBus(); afterAll(() => { - player._bus.connection.stream.end(); - bus.connection.stream.end(); + player._bus.disconnect(); + bus.disconnect(); }); test('calling methods should raise a signal on the player', async () => { let obj = await bus.getProxyObject('org.mpris.MediaPlayer2.roottest', '/org/mpris/MediaPlayer2'); - let root = obj.getInterface(ROOT_IFACE); + let root = obj.interfaces[ROOT_IFACE]; if (!root) { // XXX need to wait a beat for the service to start up