hubot-mockadapter
mock adapter for unit-testing Webbybot and Hubot
Rewrote from hubot-mock-adapter
An Adapter
implementation could be spied on. For writing unit tests for Webbybot and Hubot scripts.
example usage
Let's assume you've got a really simple script, like this:
module { robot;};
You want to test this, of course. So create a Mocha test:
var expect = expect;var path = ; var Robot = ;var TextMessage = TextMessage; ;
You'll need devDependencies
something like this in your package.json
:
"devDependencies": "chai": "~1.9.0" "hubot-mockadapter": "~1.0.0" "mocha": "~1.17.1" "webbybot": "^0.2.1" "sinon": "~1.9.0"
That's (almost) all there is to it!
firing up Mocha
Assuming you're using mocha
to run your tests, and your
tests are in test/
. add a test
script in your package.json
:
"scripts": "test": "mocha --compilers js:babel-register"
Then you can use npm test
to run your tests!