kakashi

0.3.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i kakashi

Weekly Downloads

2

Version

0.3.2

License

MIT

Last publish

Collaborators

  • bouzuya