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

node-mocks-http

Package Overview
Dependencies
Maintainers
4
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mocks-http - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5

2

CONTRIBUTING.md

@@ -43,3 +43,3 @@ # Contributing

### Submitting an Issue
Before you submit your issue search the [archive][archive], maybe your question was already answered. Let's avoid duplicates.
Before you submit your issue search the [archive][issues-archive], maybe your question was already answered. Let's avoid duplicates.

@@ -46,0 +46,0 @@ If you believe your issue is a bug, and you can't find a issue in the [archive][issues-archive], just open a new issue.

@@ -9,3 +9,3 @@ 'use strict';

var request = require('./mock-request');
var response = require('./mock-response');
var response = require('../mockResponse');

@@ -23,3 +23,3 @@ function createApplication() {

app.response = {
__proto__: response,
__proto__: response.createResponse(),
app: app

@@ -26,0 +26,0 @@ };

@@ -11,3 +11,3 @@ 'use strict';

var defineGetter = require('./utils/define-getter');
var http = require('./node/http');
var http = require('http');

@@ -14,0 +14,0 @@ var req = exports = module.exports = {

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

var response = require('./mockResponse');
var express = require('./express/mock-express');

@@ -34,1 +35,2 @@ /**

exports.createMocks = createRequestResponse;
exports.express = express;

@@ -18,4 +18,5 @@ 'use strict';

EventEmitter.prototype.emit = function () {};
EventEmitter.prototype.prependListener = function () {};
// EventEmitter.prototype.emit = function(event, [arg1], [arg2], [...]){}
module.exports = EventEmitter;

@@ -35,3 +35,3 @@ 'use strict';

var accepts = require('accepts');
var events = require('events');
var EventEmitter = require('events').EventEmitter;

@@ -56,5 +56,9 @@ var standardRequestOptions = [

// creat mockRequest
if (options.eventEmitter) {
EventEmitter = options.eventEmitter;
}
var mockRequest = Object.create(events.EventEmitter.prototype);
// create mockRequest
var mockRequest = Object.create(EventEmitter.prototype);
EventEmitter.call(mockRequest);

@@ -61,0 +65,0 @@ mockRequest.method = (options.method) ? options.method : 'GET';

@@ -55,3 +55,2 @@ 'use strict';

var writableStream = new WritableStream();
var eventEmitter = new EventEmitter();

@@ -61,3 +60,4 @@ var mockRequest = options.req;

var mockResponse = {};
var mockResponse = Object.create(EventEmitter.prototype);
EventEmitter.call(mockResponse);

@@ -214,3 +214,3 @@ mockResponse._headers = {};

mockResponse.emit('send');
mockResponse.emit('end');
mockResponse.end();

@@ -277,3 +277,3 @@ };

mockResponse.emit('send');
mockResponse.emit('end');
mockResponse.end();

@@ -316,3 +316,3 @@ };

mockResponse.emit('send');
mockResponse.emit('end');
mockResponse.end();

@@ -404,2 +404,3 @@ };

mockResponse.emit('end');
mockResponse.emit('finish');

@@ -546,3 +547,3 @@ };

mockResponse.emit('end');
mockResponse.end();
};

@@ -572,3 +573,3 @@

mockResponse.emit('render');
mockResponse.emit('end');
mockResponse.end();

@@ -630,34 +631,2 @@ };

mockResponse.addListener = function() {
return eventEmitter.addListener.apply(this, arguments);
};
mockResponse.on = function() {
return eventEmitter.on.apply(this, arguments);
};
mockResponse.once = function() {
return eventEmitter.once.apply(this, arguments);
};
mockResponse.removeListener = function() {
return eventEmitter.removeListener.apply(this, arguments);
};
mockResponse.removeAllListeners = function() {
return eventEmitter.removeAllListeners.apply(this, arguments);
};
mockResponse.setMaxListeners = function() {
return eventEmitter.setMaxListeners.apply(this, arguments);
};
mockResponse.listeners = function() {
return eventEmitter.listeners.apply(this, arguments);
};
mockResponse.emit = function() {
return eventEmitter.emit.apply(this, arguments);
};
//This mock object stores some state as well

@@ -664,0 +633,0 @@ //as some test-analysis functions:

@@ -5,3 +5,3 @@ {

"description": "Mock 'http' objects for testing Express routing functions",
"version": "1.5.4",
"version": "1.5.5",
"homepage": "https://github.com/howardabrams/node-mocks-http",

@@ -45,4 +45,11 @@ "bugs": {

"accepts": "^1.3.3",
"depd": "^1.1.0",
"fresh": "^0.3.0",
"lodash.assign": "^4.0.6",
"merge-descriptors": "^1.0.1",
"methods": "^1.1.2",
"mime": "^1.3.4",
"net": "^1.0.2",
"parseurl": "^1.3.1",
"range-parser": "^1.2.0",
"type-is": "^1.6.4"

@@ -63,4 +70,5 @@ },

"scripts": {
"test": "gulp spec"
"test": "gulp spec",
"postversion": "npm publish && git push --follow-tags"
}
}

@@ -48,2 +48,5 @@ 'use strict';

expect(mockEventEmitter.emit).to.be.a('function');
expect(mockEventEmitter).to.have.property('prependListener');
expect(mockEventEmitter.prependListener).to.be.a('function');
});

@@ -60,4 +63,6 @@

expect(mockEventEmitter.emit()).to.be.undefined;
expect(mockEventEmitter.prependListener()).to.be.undefined;
});
});

@@ -131,2 +131,5 @@ 'use strict';

expect(response.emit).to.be.a('function');
expect(response).to.have.property('prependListener');
expect(response.prependListener).to.be.a('function');
});

@@ -494,5 +497,6 @@

expect(response._getRenderData()).to.deep.equal({});
expect(response.emit).to.have.been.calledTwice;
expect(response.emit).to.have.been.calledThrice;
expect(response.emit).to.have.been.calledWith('render');
expect(response.emit).to.have.been.calledWith('end');
expect(response.emit).to.have.been.calledWith('finish');
});

@@ -507,5 +511,6 @@

expect(response._getRenderData()).to.deep.equal(data);
expect(response.emit).to.have.been.calledTwice;
expect(response.emit).to.have.been.calledThrice;
expect(response.emit).to.have.been.calledWith('render');
expect(response.emit).to.have.been.calledWith('end');
expect(response.emit).to.have.been.calledWith('finish');
});

@@ -540,5 +545,6 @@

response.json({});
expect(response.emit).to.have.been.calledTwice;
expect(response.emit).to.have.been.calledThrice;
expect(response.emit).to.have.been.calledWith('send');
expect(response.emit).to.have.been.calledWith('end');
expect(response.emit).to.have.been.calledWith('finish');
});

@@ -578,5 +584,6 @@

response.jsonp({});
expect(response.emit).to.have.been.calledTwice;
expect(response.emit).to.have.been.calledThrice;
expect(response.emit).to.have.been.calledWith('send');
expect(response.emit).to.have.been.calledWith('end');
expect(response.emit).to.have.been.calledWith('finish');
});

@@ -905,2 +912,8 @@ });

describe('.prependListener()', function() {
it('should inherit from Node EventEmitter.prependListener()');
});
});

@@ -907,0 +920,0 @@

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