kakashi
v0.3.2 hubot test
kakashi
A test driver for Hubot scripts.
Installation
$ npm install kakashi
Example
hello.js
module.exports = function(robot) {
robot.respond(/hello$/, function(res) {
res.send('hello!');
});
};
test/hello.js
(for mocha)
var Kakashi = require('kakashi').Kakashi;
describe('hello', function() {
beforeEach(function(done) {
this.kakashi = new Kakashi();
this.kakashi.scripts = [require('../hello.js')];
this.kakashi.users = [{ id: 'bouzuya', room: 'hitoridokusho' }];
this.kakashi.start().then(done, done);
});
afterEach(function(done) {
this.kakashi.stop().then(done, done);
});
describe('receive "hello"', function() {
it('send "hello!"', function(done) {
this.kakashi
.receive({ room: 'my-room' }, 'hello')
.then(function() {
expect(this.kakashi.send.firstCall.args[1]).to
.equal('hello!');
}.bind(this))
.then(done, done);
});
});
});
See example (bouzuya/hubot-url)
License
MIT