From 14d529953e57926a4a4f7ac275f76820f616b695 Mon Sep 17 00:00:00 2001 From: Tom Udding Date: Sat, 9 Apr 2022 15:24:23 +0200 Subject: [PATCH] Add unit test for new no send behaviour --- packages/server/test/unit/plugins/util_spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/server/test/unit/plugins/util_spec.js b/packages/server/test/unit/plugins/util_spec.js index af64da26c552..0862675652be 100644 --- a/packages/server/test/unit/plugins/util_spec.js +++ b/packages/server/test/unit/plugins/util_spec.js @@ -10,6 +10,7 @@ describe('lib/plugins/util', () => { this.theProcess = { send: sinon.spy(), on: sinon.stub(), + connected: true, } this.ipc = util.wrapIpc(this.theProcess) @@ -31,6 +32,13 @@ describe('lib/plugins/util', () => { expect(this.theProcess.send).not.to.be.called }) + it('#send does not send if process has been disconnected', function () { + this.theProcess.connected = false + this.ipc.send('event-name') + + expect(this.theProcess.send).not.to.be.called + }) + it('#on listens for process messages that match event', function () { const handler = sinon.spy()