Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubot-npm

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubot-npm - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

test/events/package:publish.json

10

index.js

@@ -12,5 +12,13 @@ // Description:

const getMessage = (hook) => {
const url = `https://www.npmjs.com/package/${hook.name}`;
switch (hook.event) {
case 'package:star':
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 – https://www.npmjs.com/package/${hook.name}`;
return `${hook.name}@${hook.change.version} published – ${url}`;
case 'package:unpublish':
return `${hook.name}@${hook.change.version} unpublished – ${url}`;
}

@@ -17,0 +25,0 @@ };

2

package.json
{
"name": "hubot-npm",
"version": "0.0.5",
"version": "0.0.6",
"description": "Hubot script for npm notifications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -32,3 +32,3 @@ # hubot-npm

```
<HUBOT_URL>:<PORT>/hubot/npm?room=<room>
<hubot_url>:<port>/hubot/npm?room=<room>
```

@@ -41,3 +41,3 @@

```
wombat hook add npm <HUBOT_URL>:<PORT>/hubot/npm?room=<room> <secret>
wombat hook add <user|package|scope> <hubot_url>:<port>/hubot/npm?room=<room> <secret>
```

@@ -12,3 +12,6 @@ 'use strict';

const events = {
publish: require('./events/publish')
'package:publish': require('./events/package:publish'),
'package:unpublish': require('./events/package:unpublish'),
'package:star': require('./events/package:star'),
'package:unstar': require('./events/package:unstar')
};

@@ -36,28 +39,80 @@

describe('when a package is published', () => {
it('announces the package to the room', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(events.publish)
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 published – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:publish hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(events['package:publish'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 published – 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)
.expect(400, done);
});
it('supports the package:unpublish hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(events['package:unpublish'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 unpublished – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:star hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(events['package:star'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'a-user starred npm-hook-test – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:unstar hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(events['package:unstar'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'a-user unstarred npm-hook-test – 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)
.expect(400, done);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc