UNPKG

908 Btext/coffeescriptView Raw
1chai = require 'chai'
2sinon = require 'sinon'
3chai.use require 'sinon-chai'
4
5expect = chai.expect
6
7describe 'i have no idea what i\'m doing:', ->
8 ihavenoidea_module = require('../src/ihavenoidea')
9 imageUrlRegex = /^https?:\/\/(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:\/[^\/#?]+)+\.(?:jpe?g|gif|png)$/i
10
11 beforeEach ->
12 @robot =
13 respond: sinon.spy()
14 hear: sinon.spy()
15 @msg =
16 send: sinon.spy()
17 random: sinon.spy()
18 @ihavenoidea_module = ihavenoidea_module(@robot)
19
20 it 'should register a hear listener', ->
21 expect(@robot.hear).to.have.been.calledWith(/i have no idea what i'm doing/)
22
23 # it 'should not register a hear listener', ->
24 # expect(@robot.hear).to.not.have.been.calledWith(/troops/)
25
26 # it 'should return an image url', ->
27 # callback = @robot.hear.firstCall.args[1]
28 # callback(@msg)
29 # expect(@msg.send).to.have.been.calledWithMatch(imageUrlRegex)
30