From 11b0712a45b6b58428a002a87c032aa4fc8b4815 Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 10 Apr 2020 16:15:57 -0700 Subject: [PATCH 1/2] Force mocha to use proper exit codes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8bef9e7..81db59a 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "main": "index.js", "scripts": { "eslint": "eslint .", - "test": "nyc mocha" + "test": "nyc mocha --exit" }, "nyc": { "temp-directory": "./coverage/.nyc_output", From 3b9f42957c0ea10acb605a387be0fa786464f613 Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 10 Apr 2020 16:16:39 -0700 Subject: [PATCH 2/2] Fix Spark tests to match updated adapter --- test/test-formatdata.js | 4 ++-- test/test-postdata.js | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/test/test-formatdata.js b/test/test-formatdata.js index 1096171..aae10bf 100644 --- a/test/test-formatdata.js +++ b/test/test-formatdata.js @@ -395,7 +395,7 @@ describe('SparkFormatter', function() { var msg = { message: { user: { - room: "SparkRoomName", + roomId: "SparkRoomId", name: "SparkUserName" } } @@ -404,7 +404,7 @@ describe('SparkFormatter', function() { expect(o.name).to.be.an('string'); expect(o.name).to.equal('SparkUserName'); expect(o.room).to.be.an('string'); - expect(o.room).to.equal('SparkRoomName'); + expect(o.room).to.equal('SparkRoomId'); }); }); diff --git a/test/test-postdata.js b/test/test-postdata.js index 9ce6b5f..9a04fe0 100644 --- a/test/test-postdata.js +++ b/test/test-postdata.js @@ -902,7 +902,9 @@ describe("spark post data", function() { expect(robot.messageRoom).to.have.been.calledOnce; expect(robot.messageRoom).to.have.been.calledWith( { - channel: input.channel, + id: input.channel, + roomId: input.channel, + name: input.user, extra: undefined }, user + "normal boring text" @@ -912,6 +914,7 @@ describe("spark post data", function() { it('should post to room and not mention a user', function() { robot.messageRoom = sinon.spy(); var input = { + user: 'stanley', channel: '#stackstorm', message: "normal boring text", whisper: false @@ -922,10 +925,12 @@ describe("spark post data", function() { expect(robot.messageRoom).to.have.been.calledOnce; expect(robot.messageRoom).to.have.been.calledWith( { - channel: input.channel, + id: input.channel, + roomId: input.channel, + name: input.user, extra: undefined }, - "normal boring text" + "stanley: normal boring text" ); }); @@ -947,7 +952,9 @@ describe("spark post data", function() { expect(robot.messageRoom).to.have.been.calledOnce; expect(robot.messageRoom).to.have.been.calledWith( { - channel: input.channel, + id: input.channel, + roomId: input.channel, + name: input.user, extra: { custom1: "attribute1", custom2: "attribute2" @@ -992,7 +999,9 @@ describe("spark post data", function() { expect(robot.messageRoom).to.have.been.calledOnce; expect(robot.messageRoom).to.have.been.calledWith( { - channel: input.channel, + id: input.channel, + roomId: input.channel, + name: input.user, extra: undefined }, user + "NORMAL PRETEXT\nnormal boring text"