Socket
Socket
Sign inDemoInstall

web-app-runner

Package Overview
Dependencies
31
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.90.29 to 0.90.30

4

lib/WebAppRunner.js

@@ -27,3 +27,3 @@ /**

app = options.app,
connection;
connection = options.connection;

@@ -171,2 +171,4 @@ /**

}
return child;
};

@@ -173,0 +175,0 @@

{
"name": "web-app-runner",
"version": "0.90.29",
"version": "0.90.30",
"description": "A simple HTTP application server that accepts or rejects connections based on authenticated attributes including ip, user agent, etc. The server can be used stand alone or as middleware for connect or express.",

@@ -17,3 +17,3 @@ "main": "./index.js",

"dependencies": {
"background-service-runner": "^0.90.14",
"background-service-runner": "^0.90.16",
"connect": "^3.1.0",

@@ -20,0 +20,0 @@ "lodash": "~2.4.1",

@@ -211,2 +211,2 @@ # Web App Runner

- - -
<p><small><em>Copyright © 2014, rain city software | Version 0.90.29</em></small></p>
<p><small><em>Copyright © 2014, rain city software | Version 0.90.30</em></small></p>

@@ -10,3 +10,6 @@ /**

log = require('simple-node-logger' ).createSimpleLogger(),
WebAppRunner = require('../lib/WebAppRunner');
IPFilter = require('../lib/IPFilter' ),
Visitor = require('../lib/Visitor' ),
WebAppRunner = require('../lib/WebAppRunner' ),
MockChild = require( 'background-service-runner' ).mocks.MockChild;

@@ -18,2 +21,40 @@ describe('WebAppRunner', function() {

var MockServiceRunner = function() {
var runner = {};
runner.start = function(command, args) {
runner.command = command;
runner.args = args;
return new MockChild();
};
this.createDaemonRunner = function() {
return runner;
};
};
var MockConnection = function() {
var con = this;
this.closed = true;
this.close = function(cb) {
con.closed = true;
if (cb) {
cb();
}
};
};
var MockConnect = function() {
this.use = function() {
};
this.listen = function(port) {
return new MockConnection();
};
};
var createOptions = function() {

@@ -24,3 +65,3 @@ var opts = {};

opts.port = dash.random( 1000, 20000 );
opts.piddir = '/tmp';
opts.ipfilter = new IPFilter( opts );

@@ -58,6 +99,19 @@ return opts;

describe('#runInstance', function() {
it('should create a child instance and write the pid to process file');
var server,
opts = createOptions();
opts.serviceRunner = new MockServiceRunner();
server = new WebAppRunner( opts );
it('should create a child instance and write the pid to process file', function() {
var child = server.__protected().runInstance();
should.exist( child );
child.pid.should.be.above( 1000 );
});
});
describe('shutdown', function() {
it('should reject a shutdown request from non-local host ip');

@@ -68,3 +122,15 @@ it('should issue a shutdown and stop from a local host ip');

describe('stop', function() {
it('should close an open connection');
var server,
opts = createOptions();
opts.connection = new MockConnection();
opts.connection.closed = false;
server = new WebAppRunner( opts );
it('should close an open connection', function() {
server.stop();
opts.connection.closed.should.equal( true );
});
});

@@ -81,8 +147,21 @@

describe('createApp', function() {
it('should create a connect app with middleware');
var server = new WebAppRunner( createOptions() );
it('should create a connect app with middleware', function() {
var app = server.createApp();
should.exist( app );
// console.log( app );
app.stack.length.should.be.above( 4 );
});
});
describe('start', function() {
var server,
opts = createOptions();
opts.app = new MockConnect();
it('should create a mock app and start a mock server');
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc