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

beepboop

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beepboop - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

.travis.yml

5

lib/resourcer.js

@@ -114,4 +114,2 @@ 'use strict'

msg = JSON.parse(payload)
resourcer.emit(msg.type, msg)
log.debug('Message received from Beep Boop server: ', JSON.stringify(msg))
} catch (err) {

@@ -122,2 +120,5 @@ resourcer.emit('error', err)

}
resourcer.emit(msg.type, msg)
log.debug('Message received from Beep Boop server: ', JSON.stringify(msg))
}

@@ -124,0 +125,0 @@

2

package.json
{
"name": "beepboop",
"version": "1.1.0",
"version": "1.1.1",
"description": "beepboop eases hosting a botkit based bot on the beepboop hosting platform.",

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

@@ -0,1 +1,3 @@

[![Build Status](https://travis-ci.org/BeepBoopHQ/beepboop-js.svg)](https://travis-ci.org/BeepBoopHQ/beepboop-js)
## The beepboop bot multi-team management node module

@@ -15,3 +17,3 @@

At a minimum, the client needs the following environment variables set which can be obtained from the development area of the http://beebboophq.com site.
At a minimum, the client needs the following environment variables set which can be obtained from the development area of the http://beepboophq.com site.

@@ -57,3 +59,3 @@ * `BEEPBOOP_RESOURCER` -- url to the Beep Boop Server

```javascript
beepboop.on('open', function () {
beepboop.on('open', function () {
console.log('connection to Beep Boop server opened')

@@ -68,3 +70,3 @@ })

```javascript
beepboop.on('error', function (error) {
beepboop.on('error', function (error) {
console.log('Error from Beep Boop connection: ', err)

@@ -79,3 +81,3 @@ })

```javascript
beepboop.on('close', function (code, message) {
beepboop.on('close', function (code, message) {
console.log('Connection to Beep Boop was closed')

@@ -90,3 +92,3 @@ }

```javascript
beepboop.on('add_resource', function (message) {
beepboop.on('add_resource', function (message) {
console.log('Team added: ', message)

@@ -110,3 +112,9 @@ // Create a connection to the Slack RTM on behalf of the team

"SlackBotAccessToken": "xoxb-xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",
"SlackBotUserID": "XXXXXXXXX",
"SlackBotUserName": "name-of-bot-user",
// Regular access token - will contain additional scopes requested
"SlackAccessToken": "XXXXXXXXX",
"SlackTeamName": "Name of Team",
"SlackTeamID": "XXXXXXXXX",
"SlackUserID": "XXXXXXXXX",
"CUSTOM_CONFIG": "Value for CUSTOM_CONFIG"

@@ -125,3 +133,3 @@ }

```javascript
beepboop.on('update_resource', function (message) {
beepboop.on('update_resource', function (message) {
console.log('Team Updated: ', message)

@@ -141,4 +149,11 @@ // may need to update local config for team or re-establish the Slack RTM connection

"resource": {
// Token you should use to connect to the Slack RTM API
"SlackBotAccessToken": "xoxb-xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",
"SlackBotUserID": "XXXXXXXXX",
"SlackBotUserName": "name-of-bot-user",
// Regular access token - will contain additional scopes requested
"SlackAccessToken": "XXXXXXXXX",
"SlackTeamName": "Name of Team",
"SlackTeamID": "XXXXXXXXX",
"SlackUserID": "XXXXXXXXX",
"CUSTOM_CONFIG": "Updated Value for Config"

@@ -154,3 +169,3 @@ }

```javascript
beepboop.on('update_resource', function (message) {
beepboop.on('remove_resource', function (message) {
console.log('Team Removed: ', message)

@@ -171,2 +186,1 @@ // You'll want to disconnect from the Slack RTM connection you made, and perform any cleanup needed

```

@@ -9,3 +9,2 @@ var events = require('events')

var resourcer
var called

@@ -20,3 +19,2 @@ beforeEach(function () {

resourcer.connect(socket)
called = false
})

@@ -30,2 +28,3 @@

it('handles error event', function () {
var called = false
resourcer.on('error', function (err) {

@@ -41,19 +40,13 @@ called = true

it('handles open event', function () {
resourcer.on('open', function () {
called = true
})
var spy = sinon.spy(resourcer, 'emit')
socket.emit('open')
assert.equal(called, true)
assert(spy.calledWith('open'))
})
it('handles close event', function () {
resourcer.on('close', function (code, message) {
called = true
assert.equal(code, 1000)
assert.equal(message, 'closed')
})
var spy = sinon.spy(resourcer, 'emit')
socket.emit('close', 1000, 'closed')
assert.equal(called, true)
assert(spy.calledWith('close', 1000, 'closed'))
})

@@ -63,42 +56,59 @@

it('handles add_resource event', function () {
resourcer.on('add_resource', function (msg) {
called = true
assert.deepEqual(msg, {'type': 'add_resource', 'ResourceID': '4zewnkfyldi'})
})
var spy = sinon.spy(resourcer, 'emit')
var message = {'type': 'add_resource', 'ResourceID': '4zewnkfyldi'}
socket.emit('message', '{"type": "add_resource", "ResourceID":"4zewnkfyldi"}')
assert.equal(called, true)
socket.emit('message', JSON.stringify(message))
assert.equal(spy.calledWith('add_resource', message), true)
})
it('handles update_resource event', function () {
resourcer.on('update_resource', function (msg) {
called = true
assert.deepEqual(msg, {'type': 'update_resource', 'ResourceID': '4zewnkfyldi-update'})
})
var spy = sinon.spy(resourcer, 'emit')
var message = {'type': 'update_resource', 'ResourceID': '4zewnkfyldi-update'}
socket.emit('message', '{"type": "update_resource", "ResourceID":"4zewnkfyldi-update"}')
assert.equal(called, true)
socket.emit('message', JSON.stringify(message))
assert.equal(spy.calledWith('update_resource', message), true)
})
it('handles remove_resource event', function () {
resourcer.on('remove_resource', function (msg) {
called = true
assert.deepEqual(msg, {'type': 'remove_resource', 'ResourceID': '4zewnkfyldi-update'})
})
var spy = sinon.spy(resourcer, 'emit')
var message = {'type': 'remove_resource', 'ResourceID': '4zewnkfyldi-update'}
socket.emit('message', '{"type": "remove_resource", "ResourceID":"4zewnkfyldi-update"}')
assert.equal(called, true)
socket.emit('message', JSON.stringify(message))
assert.equal(spy.calledWith('remove_resource', message), true)
})
it('handles auth_result event', function () {
resourcer.on('auth_result', function (msg) {
var spy = sinon.spy(resourcer, 'emit')
var message = {'type': 'auth_result', 'ResourceID': '4zewnkfyldi-update', 'success': 'true'}
socket.emit('message', JSON.stringify(message))
assert.equal(spy.calledWith('auth_result', message), true)
})
it('handles a bad message', function () {
var called = false
resourcer.on('error', function () {
called = true
assert.deepEqual(msg, {'type': 'auth_result', 'ResourceID': '4zewnkfyldi-update', 'success': 'true'})
})
socket.emit('message', '{"type": "auth_result", "ResourceID":"4zewnkfyldi-update", "success": "true"}')
socket.emit('message', '{"type": ""auth_result", "ResourceID":"4zewnkfyldi-update", "success": "true"}')
assert.equal(called, true)
})
it('does not emit an error if listener throws', function () {
var spy = sinon.spy(resourcer, 'emit')
resourcer.on('auth_result', function () {
throw new Error('kaboom')
})
try {
socket.emit('message', '{"type": "auth_result", "ResourceID":"4zewnkfyldi-update", "success": "true"}')
} catch (e) {
assert.equal(e.message, 'kaboom')
}
assert.equal(spy.calledWith('error'), false)
})
})
})
})
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