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
|
try
|
||||||
report = JSON.parse body
|
report = JSON.parse body
|
||||||
catch e
|
catch e
|
||||||
return res.send 'errore'
|
return res.send 'Errore: '+e
|
||||||
unless report?.files?.push? and report?.coverage?.toFixed?
|
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 = '=== Coverage: ' + report.coverage.toFixed(0) + '%'
|
||||||
t += report.files.map (f) ->
|
t += report.files.map (f) ->
|
||||||
'\n - ' + f.filename + ' is covered at ' + f.coverage.toFixed(0) + '%'
|
'\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(':','#')
|
r = room: process.env.AUTO_INFORM_ON_START.replace(':','#')
|
||||||
robot.send r, 'asjon avviato e operativo!'
|
robot.send r, 'asjon avviato e operativo!'
|
||||||
|
|
||||||
robot.router.post '/hubot/githubhook/:room/:name?', (req, res) ->
|
githubhook = (req, res) ->
|
||||||
res.send 200
|
res.send 200
|
||||||
dest = name: req.params.name, room: req.params.room.replace(':','#')
|
dest = name: req.params.name, room: req.params.room.replace(':','#')
|
||||||
robot.emit 'githubhook', req.body, req.params
|
robot.emit 'githubhook', req.body, req.params
|
||||||
@ -26,6 +26,9 @@ module.exports = (robot) ->
|
|||||||
cm = req.body.commits.map (c) ->
|
cm = req.body.commits.map (c) ->
|
||||||
[c.committer.username,c.message].join ' -> '
|
[c.committer.username,c.message].join ' -> '
|
||||||
robot.send dest, s+cm.join('\n')
|
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) ->
|
robot.respond /(?:(?:mostra(?:mi)?|fammi vedere) )?(?:le )?issue(?:s)?/i, (res) ->
|
||||||
msg = state: 'open', user: 'fazo96', repo: 'asjon', sort: 'updated'
|
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) ->
|
robot.respond /linkami (?:la )?repo (\w+\/\w+)/i, (res) ->
|
||||||
res.send 'https://github.com/'+res.match[1]
|
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')
|
.get('/github.com/fazo96/asjon/files/coverage/coverage.json')
|
||||||
.reply 200, 'invalid answer'
|
.reply 200, 'invalid answer'
|
||||||
asjon.receive (e,l) ->
|
asjon.receive (e,l) ->
|
||||||
l.join().should.equal 'errore'
|
l.join().should.match /^Errore: SyntaxError: Unexpected token/g
|
||||||
done()
|
done()
|
||||||
asjon.send 'asjon coverage'
|
asjon.send 'asjon coverage'
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ expect = require("chai").should()
|
|||||||
Asjon = require '../asjon-testing.coffee'
|
Asjon = require '../asjon-testing.coffee'
|
||||||
asjon = undefined
|
asjon = undefined
|
||||||
|
|
||||||
describe 'modulo github', ->
|
describe 'modulo wolfram', ->
|
||||||
before (done) ->
|
before (done) ->
|
||||||
# Inizializzo robot
|
# Inizializzo robot
|
||||||
Asjon (assa) ->
|
Asjon (assa) ->
|
||||||
@ -53,20 +53,3 @@ describe 'modulo github', ->
|
|||||||
acc++
|
acc++
|
||||||
if acc is 2 then done()
|
if acc is 2 then done()
|
||||||
asjon.send 'asjon wfa test'
|
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