StackStorm / hubot-stackstorm

Hubot plugin for integration with StackStorm event-driven infrastructure automation platform.
Apache License 2.0
49 stars 39 forks source link

Fix tests #201

Closed blag closed 4 years ago

blag commented 4 years ago

For PR #200 it looked like the build passed. But looking at the individual jobs:

...
  141 passing (482ms)
  5 failing
  1) SparkFormatter
       should normalize the addressee:
     AssertionError: expected undefined to be a string
      at Context.<anonymous> (test/test-formatdata.js:406:26)

  2) spark post data
       should post to room and mention a user:
     AssertionError: expected messageRoom to have been called with arguments { channel: "#stackstorm", extra: undefined }, stanley: normal boring text
{ extra: undefined, id: "#stackstorm", name: "stanley", roomId: "#stackstorm" } { channel: "#stackstorm", extra: undefined } 
stanley: normal boring text
      at Context.<anonymous> (test/test-postdata.js:903:44)

  3) spark post data
       should post to room and not mention a user:
     AssertionError: expected messageRoom to have been called with arguments { channel: "#stackstorm", extra: undefined }, normal boring text
{ extra: undefined, id: "#stackstorm", name: undefined, roomId: "#stackstorm" } { channel: "#stackstorm", extra: undefined } 
normal boring text
      at Context.<anonymous> (test/test-postdata.js:923:44)

  4) spark post data
       should post to room with extra:
     AssertionError: expected messageRoom to have been called with arguments { channel: "#stackstorm", extra: { custom1: "attribute1", custom2: "attribute2" } }, stanley: normal boring text
{
  extra: { custom1: "attribute1", custom2: "attribute2" },
  id: "#stackstorm",
  name: "stanley",
  roomId: "#stackstorm"
} { channel: "#stackstorm", extra: { custom1: "attribute1", custom2: "attribute2" } } 
stanley: normal boring text
      at Context.<anonymous> (test/test-postdata.js:948:44)

  5) spark post data
       should post message with pretext to room:
     AssertionError: expected messageRoom to have been called with arguments { channel: "#stackstorm", extra: undefined }, stanley: NORMAL PRETEXT
normal boring text
{ extra: undefined, id: "#stackstorm", name: "stanley", roomId: "#stackstorm" } { channel: "#stackstorm", extra: undefined } 
stanley: NORMAL PRETEXT
normal boring text
      at Context.<anonymous> (test/test-postdata.js:993:44)

---------------------|----------|----------|----------|----------|-------------------|
          .          |     .    |     .    |     .    |     .    |         .         |
          .          |     .    |     .    |     .    |     .    |         .         |
          .          |     .    |     .    |     .    |     .    |         .         |
---------------------|----------|----------|----------|----------|-------------------|

The command "npm test" exited with 0.
store build cache

Done. Your build exited with 0.

This is due to a bug that has been reported multiple times to mocha:

This PR fixes this by passing the --exit flag to mocha. The first commit properly fails the Travis CI tests, and the second commit fixes the tests to match the changes in PR #200, which were tested against a real instance of Cisco Spark/Webex.

Using the --exit flag isn't exactly meant to solve this problem, but it does.