forked from hubotio/hubot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle_images_test.coffee
41 lines (36 loc) · 1.16 KB
/
google_images_test.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Tests = require './tests'
assert = require 'assert'
helper = Tests.helper()
require('../src/scripts/google-images') helper
# start up a danger room for google images
danger = Tests.danger helper, (req, res, url) ->
res.writeHead 200
res.end JSON.stringify(
responseData:
results: [
unescapedUrl: "(#{url.query.q})"
]
)
# callbacks for when hubot sends messages
mu = "http://mustachify.me/?src="
tests = [
(msg) -> assert.equal "#{mu}(foo)#.png", msg
(msg) -> assert.equal "#{mu}(foo)#.png", msg
(msg) -> assert.equal "#{mu}(foo)#.png", msg
(msg) -> assert.equal "#{mu}(foo)#.png", msg
(msg) -> assert.equal "(foo)#.png", msg
(msg) -> assert.equal "(foo)#.png", msg
(msg) -> assert.equal "(foo)#.png", msg
(msg) -> assert.equal "(animated foo)#.png", msg
]
# run the async tests
danger.start tests, ->
helper.receive 'helper: stache me foo'
helper.receive 'helper: stache foo'
helper.receive 'helper: mustache me foo'
helper.receive 'helper: mustache foo'
helper.receive 'helper: img foo'
helper.receive 'helper: image me foo'
helper.receive 'helper: image foo'
helper.receive 'helper: animate me foo'
helper.stop()