kakashi
A test driver for Hubot scripts.
Last updated 6 years ago by bouzuya .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install kakashi 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.3.2                                ...           latest (6 years ago)

7 Versions

  • 0.3.2                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |