diff --git a/package.json b/package.json index 80d5f83..5d91b8a 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,23 @@ "private": true, "description": "A hubot install for the Hubot community", "dependencies": { + "coffee-script": "^1.12.6", "hubot": "^2.19.0", "hubot-help": "^0.2.0", "hubot-redis-brain": "0.0.3", "hubot-rules": "^0.1.1", "hubot-shipit": "^0.2.0", "hubot-slack": "^4.3.4", + "mocha": "^3.4.2", "moment-timezone": "^0.5.13" }, + "devDependencies": { + "chai": "^4.0.2", + "hubot-test-helper": "^1.5.1" + }, + "scripts": { + "test": "mocha --compilers coffee:coffee-script/register" + }, "engines": { "node": "4.8.3" } diff --git a/test/test.coffee b/test/test.coffee new file mode 100644 index 0000000..d770021 --- /dev/null +++ b/test/test.coffee @@ -0,0 +1,25 @@ +Helper = require('hubot-test-helper') +# helper loads all scripts passed a directory +helper = new Helper('../scripts') + +co = require('co') +expect = require('chai').expect + +describe 'hubot', -> + + beforeEach -> + @room = helper.createRoom(httpd: false) + + afterEach -> + @room.destroy() + + context 'user says hi to hubot', -> + beforeEach -> + co => + yield @room.user.say 'alice', '@hubot ping' + + it 'should reply to user', -> + expect(@room.messages).to.eql [ + ['alice', '@hubot ping'] + ['hubot', 'PONG'] + ]