imubot
Version:
A simple helpful bot.
82 lines (57 loc) • 1.86 kB
text/coffeescript
chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
Adapter = require '../src/adapter.coffee'
describe 'Adapter', ->
beforeEach ->
=
receive: sinon.spy()
# this one is hard, as it requires files
it "can load adapter by name"
describe 'Public API', ->
beforeEach ->
= new Adapter()
it 'assigns bot', ->
expect(.bot).to.equal()
describe 'send', ->
it 'is a function', ->
expect(.send).to.be.a('function')
it 'does nothing', ->
.send({}, 'nothing')
describe 'reply', ->
it 'is a function', ->
expect(.reply).to.be.a('function')
it 'does nothing', ->
.reply({}, 'nothing')
describe 'topic', ->
it 'is a function', ->
expect(.topic).to.be.a('function')
it 'does nothing', ->
.topic({}, 'nothing')
describe 'topic', ->
it 'is a function', ->
expect(.topic).to.be.a('function')
it 'does nothing', ->
.topic({}, 'nothing')
describe 'play', ->
it 'is a function', ->
expect(.play).to.be.a('function')
it 'does nothing', ->
.play({}, 'nothing')
describe 'run', ->
it 'is a function', ->
expect(.run).to.be.a('function')
it 'does nothing', ->
.run()
describe 'close', ->
it 'is a function', ->
expect(.close).to.be.a('function')
it 'does nothing', ->
.close()
it 'dispatches received messages to the bot', ->
.receive = sinon.spy()
= new Adapter()
= sinon.spy()
.receive()
expect(.receive).to.have.been.calledWith()