hubot-async
Version:
A simple helpful robot for your Company
75 lines (52 loc) • 1.7 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 robot', ->
expect( .robot).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 '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 robot', ->
.receive = sinon.spy()
= new Adapter( )
= sinon.spy()
.receive( )
expect( .receive).to.have.been.calledWith( )