fix robaccia che ho dimenticato nell'ultimo commit
This commit is contained in:
parent
ff03f693b1
commit
d807714395
@ -23,9 +23,9 @@ module.exports = (robot) ->
|
||||
try
|
||||
report = JSON.parse body
|
||||
catch e
|
||||
return res.send 'errore'
|
||||
return res.send 'Errore: '+e
|
||||
unless report?.files?.push? and report?.coverage?.toFixed?
|
||||
return res.send 'errore'
|
||||
return res.send 'Errore: informazioni insufficienti'
|
||||
t = '=== Coverage: ' + report.coverage.toFixed(0) + '%'
|
||||
t += report.files.map (f) ->
|
||||
'\n - ' + f.filename + ' is covered at ' + f.coverage.toFixed(0) + '%'
|
||||
|
@ -18,7 +18,7 @@ module.exports = (robot) ->
|
||||
r = room: process.env.AUTO_INFORM_ON_START.replace(':','#')
|
||||
robot.send r, 'asjon avviato e operativo!'
|
||||
|
||||
robot.router.post '/hubot/githubhook/:room/:name?', (req, res) ->
|
||||
githubhook = (req, res) ->
|
||||
res.send 200
|
||||
dest = name: req.params.name, room: req.params.room.replace(':','#')
|
||||
robot.emit 'githubhook', req.body, req.params
|
||||
@ -26,6 +26,9 @@ module.exports = (robot) ->
|
||||
cm = req.body.commits.map (c) ->
|
||||
[c.committer.username,c.message].join ' -> '
|
||||
robot.send dest, s+cm.join('\n')
|
||||
unless process.env.TESTING_ASJON
|
||||
# Disabilito http route durante i test
|
||||
robot.router.post '/hubot/githubhook/:room/:name?',
|
||||
|
||||
robot.respond /(?:(?:mostra(?:mi)?|fammi vedere) )?(?:le )?issue(?:s)?/i, (res) ->
|
||||
msg = state: 'open', user: 'fazo96', repo: 'asjon', sort: 'updated'
|
||||
@ -46,3 +49,7 @@ module.exports = (robot) ->
|
||||
robot.respond /linkami (?:la )?repo (\w+\/\w+)/i, (res) ->
|
||||
res.send 'https://github.com/'+res.match[1]
|
||||
|
||||
# rendo l'handler dell'hook di github accessibile
|
||||
# in caso serve (nei test)
|
||||
return githubhook
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe 'modulo drone', ->
|
||||
.get('/github.com/fazo96/asjon/files/coverage/coverage.json')
|
||||
.reply 200, 'invalid answer'
|
||||
asjon.receive (e,l) ->
|
||||
l.join().should.equal 'errore'
|
||||
l.join().should.match /^Errore: SyntaxError: Unexpected token/g
|
||||
done()
|
||||
asjon.send 'asjon coverage'
|
||||
|
||||
|
@ -4,7 +4,7 @@ expect = require("chai").should()
|
||||
Asjon = require '../asjon-testing.coffee'
|
||||
asjon = undefined
|
||||
|
||||
describe 'modulo github', ->
|
||||
describe 'modulo wolfram', ->
|
||||
before (done) ->
|
||||
# Inizializzo robot
|
||||
Asjon (assa) ->
|
||||
@ -53,20 +53,3 @@ describe 'modulo github', ->
|
||||
acc++
|
||||
if acc is 2 then done()
|
||||
asjon.send 'asjon wfa test'
|
||||
it.skip 'dovrebbe rispondere a "mostra le issues"', (done) ->
|
||||
questions = [
|
||||
"asjon mostrami le issue"
|
||||
"asjon mostrami le issues"
|
||||
"asjon issues"
|
||||
"asjon le issue"
|
||||
"asjon issue"
|
||||
]
|
||||
nock('https://api.github.com')
|
||||
.get('/repos/fazo96/asjon/issues?state=open&sort=updated')
|
||||
.times(questions.length)
|
||||
.reply 200, []
|
||||
acc = 0
|
||||
asjon.receive (e,l) ->
|
||||
acc++
|
||||
if acc is questions.length*2 then done()
|
||||
questions.map (q) -> asjon.send q
|
||||
|
Loading…
Reference in New Issue
Block a user