New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ellipsis-api

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ellipsis-api - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

ellipsis-api-error.js

5

__mocks__/request.js

@@ -8,5 +8,6 @@ "use strict";

const response = {
statusCode: 200,
statusCode: options.form.token ? 200 : 400,
statusMessage: options.form.token ? "Ok" : "Bad request",
url: options.url,
body: body // just echo back the options for inspection by tests
body: require('util').inspect(body) // just echo back the options for inspection by tests
};

@@ -13,0 +14,0 @@ callback(null, response, body);

48

__tests__/test.js

@@ -8,23 +8,25 @@ "use strict";

const EllipsisApi = require('../index');
const ellipsis = {
userInfo: {
messageInfo: {
medium: "slack",
channel: "C123456"
}
},
token: "123456acbdef"
};
const defaultExpectedForm = {
responseContext: ellipsis.userInfo.messageInfo.medium,
channel: ellipsis.userInfo.messageInfo.channel,
token: ellipsis.token
};
const EllipsisApiError = require('../ellipsis-api-error');
let ellipsis, defaultExpectedForm, api, actionsApi, storageApi;
const api = new EllipsisApi(ellipsis);
const actionsApi = api.actions;
const storageApi = api.storage;
describe("ActionsApi", () => {
beforeEach(() => {
ellipsis = {
userInfo: {
messageInfo: {
medium: "slack",
channel: "C123456"
}
},
token: "123456acbdef"
};
defaultExpectedForm = {
responseContext: ellipsis.userInfo.messageInfo.medium,
channel: ellipsis.userInfo.messageInfo.channel,
token: ellipsis.token
};
api = new EllipsisApi(ellipsis);
actionsApi = api.actions;
storageApi = api.storage;
});
describe("run", () => {

@@ -78,2 +80,10 @@ it("sends an appropriate api request for a name", () => {

it("throws an EllipsisApiError if a bad status code is received", () => {
expect.assertions(1);
api.ellipsis.token = null;
const trigger = "foo bar baz";
return actionsApi.run({ trigger: trigger }).catch(err => {
expect(err instanceof EllipsisApiError).toBe(true);
});
});
});

@@ -80,0 +90,0 @@

const request = require('request');
const errorMessages = require('./error-messages');
const EllipsisApiError = require('./ellipsis-api-error');

@@ -31,3 +32,3 @@ class AbstractApi {

} else {
throw new Error(error);
throw error;
}

@@ -44,3 +45,3 @@ }

} else if (response.statusCode !== 200) {
this.handleError(options, response.statusCode + ": " + response.statusMessage);
this.handleError(options, new EllipsisApiError({ response: response, body: body }));
} else if (options.success) {

@@ -160,2 +161,3 @@ options.success(body);

actionName: mergedOptions.actionName,
trigger: mergedOptions.trigger,
userId: mergedOptions.userId,

@@ -216,3 +218,3 @@ channel: this.channelFor(mergedOptions),

} else if (response.statusCode !== 200) {
reject(`${response.statusCode}: ${response.statusMessage}`);
reject(new EllipsisApiError({ response: response, body: body }));
} else {

@@ -219,0 +221,0 @@ resolve(body);

{
"name": "ellipsis-api",
"version": "0.0.9",
"version": "0.0.10",
"description": "Interact with Ellipsis skills & actions",

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

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