Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

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

Keywords

Install

npm i kakashi

DownloadsWeekly Downloads

1

Version

0.3.2

License

MIT

Last publish

Collaborators

  • avatar