Skip to content

Commit

Permalink
Merge pull request #201 from StackStorm/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
nmaludy committed Apr 11, 2020
2 parents 5a75bef + 3b9f429 commit ef3f96f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"main": "index.js",
"scripts": {
"eslint": "eslint .",
"test": "nyc mocha"
"test": "nyc mocha --exit"
},
"nyc": {
"temp-directory": "./coverage/.nyc_output",
Expand Down
4 changes: 2 additions & 2 deletions test/test-formatdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ describe('SparkFormatter', function() {
var msg = {
message: {
user: {
room: "SparkRoomName",
roomId: "SparkRoomId",
name: "SparkUserName"
}
}
Expand All @@ -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');
});
});

Expand Down
19 changes: 14 additions & 5 deletions test/test-postdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
);
});

Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit ef3f96f

Please sign in to comment.