Comparing version 0.0.6 to 0.0.7
21
index.js
@@ -17,8 +17,29 @@ // Description: | ||
return `${hook.change.user} starred ${hook.name} – ${url}`; | ||
case 'package:unstar': | ||
return `${hook.change.user} unstarred ${hook.name} – ${url}`; | ||
case 'package:publish': | ||
return `${hook.name}@${hook.change.version} published – ${url}`; | ||
case 'package:unpublish': | ||
return `${hook.name}@${hook.change.version} unpublished – ${url}`; | ||
case 'package:owner': | ||
return `${hook.name} owner added: ${hook.change.maintainer} – ${url}`; | ||
case 'package:owner-rm': | ||
return `${hook.name} owner removed: ${hook.change.maintainer} – ${url}`; | ||
case 'package:dist-tag': | ||
return `${hook.name} new dist-tag: ${hook.change['dist-tag']} – ${url}`; | ||
case 'package:dist-tag-rm': | ||
return `${hook.name} dist-tag removed: ${hook.change['dist-tag']} – ${url}`; | ||
case 'package:deprecated': | ||
return `${hook.name}@${hook.change.deprecated} deprecated – ${url}`; | ||
case 'package:undeprecated': | ||
return `${hook.name}@${hook.change.deprecated} undeprecated – ${url}`; | ||
} | ||
@@ -25,0 +46,0 @@ }; |
{ | ||
"name": "hubot-npm", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Hubot script for npm notifications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,7 +11,13 @@ 'use strict'; | ||
const events = { | ||
'package:publish': require('./events/package:publish'), | ||
'package:unpublish': require('./events/package:unpublish'), | ||
'package:star': require('./events/package:star'), | ||
'package:unstar': require('./events/package:unstar') | ||
const hooks = { | ||
'package:publish': require('./hooks/package:publish'), | ||
'package:unpublish': require('./hooks/package:unpublish'), | ||
'package:star': require('./hooks/package:star'), | ||
'package:unstar': require('./hooks/package:unstar'), | ||
'package:owner': require('./hooks/package:owner'), | ||
'package:owner-rm': require('./hooks/package:owner-rm'), | ||
'package:dist-tag': require('./hooks/package:dist-tag'), | ||
'package:dist-tag-rm': require('./hooks/package:dist-tag-rm'), | ||
'package:deprecated': require('./hooks/package:deprecated'), | ||
'package:undeprecated': require('./hooks/package:undeprecated') | ||
}; | ||
@@ -42,3 +48,3 @@ | ||
.post('/hubot/npm?room=test-room') | ||
.send(events['package:publish']) | ||
.send(hooks['package:publish']) | ||
.expect(200) | ||
@@ -61,3 +67,3 @@ .end((err) => { | ||
.post('/hubot/npm?room=test-room') | ||
.send(events['package:unpublish']) | ||
.send(hooks['package:unpublish']) | ||
.expect(200) | ||
@@ -80,3 +86,3 @@ .end((err) => { | ||
.post('/hubot/npm?room=test-room') | ||
.send(events['package:star']) | ||
.send(hooks['package:star']) | ||
.expect(200) | ||
@@ -99,3 +105,3 @@ .end((err) => { | ||
.post('/hubot/npm?room=test-room') | ||
.send(events['package:unstar']) | ||
.send(hooks['package:unstar']) | ||
.expect(200) | ||
@@ -115,8 +121,116 @@ .end((err) => { | ||
it('supports the package:owner hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:owner']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test owner added: a-user – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('supports the package:owner-rm hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:owner-rm']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test owner removed: a-user – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('supports the package:dist-tag hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:dist-tag']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test new dist-tag: beta – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('supports the package:dist-tag-rm hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:dist-tag-rm']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test dist-tag removed: beta – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('supports the package:deprecated hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:deprecated']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test@0.0.4 deprecated – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('supports the package:undeprecated hook', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm?room=test-room') | ||
.send(hooks['package:undeprecated']) | ||
.expect(200) | ||
.end((err) => { | ||
assert.ifError(err); | ||
sinon.assert.calledWith( | ||
robot.send, | ||
sinon.match({ | ||
room: ['#test-room'] | ||
}), | ||
'npm-hook-test@0.0.4 undeprecated – https://www.npmjs.com/package/npm-hook-test' | ||
); | ||
done(); | ||
}); | ||
}); | ||
it('returns a 400 when the room is missing', (done) => { | ||
request(robot.router) | ||
.post('/hubot/npm') | ||
.send(events.publish) | ||
.send(hooks.publish) | ||
.expect(400, done); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12649
18
406