Socket
Socket
Sign inDemoInstall

eh-api-client

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eh-api-client - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

1

index.js

@@ -240,2 +240,3 @@ var

var c = new Client(this.apiURL);
c._factory = this;
return c.exists.apply(c, arguments);

@@ -242,0 +243,0 @@ };

2

package.json
{
"name": "eh-api-client",
"version": "0.12.0",
"version": "0.13.0",
"description": "Node.js rest client",

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

var
Factory = require("../index"),
should = require("should"),
sinon = require("sinon");
sinon = require("sinon"),
http = require("http");
var SERVER_PORT = 8591;
var url = "http://localhost:" + SERVER_PORT;
function createServer(cb) {
var server = http.createServer();
server.listen(SERVER_PORT, function() {
cb(server);
});
}
describe("#exists", function() {
var factory = new Factory("http://localhost");
var factory = new Factory(url);
var client = factory.getClient(1, "test");
describe("tests real server", function() {
var s;
var returnStatus = 200;
var lastReq;
before(function(done) {
createServer(function(_s) {
s = _s;
s.on("request", function(req, res) {
lastReq = req;
res.statusCode = returnStatus;
res.end("Done");
});
done();
});
});
after(function(done) {
s.close(done);
});
it("should exists", function(done) {
factory.exists("/test", function(err, exists) {
should.not.exists(err);
should.ok(exists);
done();
});
});
it("should not exists", function(done) {
returnStatus = 404;
factory.exists("/test", function(err, exists) {
should.not.exists(err);
exists.should.equal(false);
done();
});
});
it("should be error", function(done) {
returnStatus = 500;
factory.exists("/test", function(err) {
should.exist(err);
err.httpStatus.should.equal(500);
done();
});
});
});
describe("resource exists", function() {

@@ -10,0 +68,0 @@ before(function() {

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