[Pkg-javascript-commits] [node-mocks-http] 126/296: Merge branch 'hotfix/1.2.6'
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-mocks-http.
commit 87245e5d6b15f49ca46a65a75cd7bcc8db32f4cb
Merge: 42183a7 01bea4a
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date: Thu Mar 19 19:44:06 2015 +0800
Merge branch 'hotfix/1.2.6'
Conflicts:
test/test-mockRequest.js
lib/mockRequest.js | 43 +++++++++++++++++++++++++++++++------------
package.json | 2 +-
test/test-mockRequest.js | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 13 deletions(-)
diff --cc package.json
index 096bf3d,ccbcfb8..0770f3e
--- a/package.json
+++ b/package.json
@@@ -2,21 -2,21 +2,21 @@@
"author": "Howard Abrams <howard.abrams at gmail.com> (http://www.github.com/howardabrams)",
"name": "node-mocks-http",
"description": "Mock 'http' objects for testing Express routing functions",
- "version": "1.2.5",
+ "version": "1.2.6",
"homepage": "http://www.github.com/howardabrams/node-mocks-http",
- "license" : "MIT",
+ "license": "MIT",
"keywords": [
- "mock",
- "stub",
- "dummy",
- "nodejs",
- "js",
- "testing",
- "test",
- "http",
- "http mock"
- ],
- "repository": {
+ "mock",
+ "stub",
+ "dummy",
+ "nodejs",
+ "js",
+ "testing",
+ "test",
+ "http",
+ "http mock"
+ ],
+ "repository": {
"type": "git",
"url": "git://github.com/howardabrams/node-mocks-http.git"
},
diff --cc test/test-mockRequest.js
index a3861c3,ab51c85..7d07161
--- a/test/test-mockRequest.js
+++ b/test/test-mockRequest.js
@@@ -49,36 -47,50 +49,80 @@@ exports['url - Setting a POST'] = funct
test.done();
};
+exports['originalUrl - Default value'] = function(test) {
+ var request = httpMocks.createRequest();
+ test.equal(request.url, request.originalUrl);
+ test.done();
+};
+
+exports['originalUrl - Default value (with url option set)'] = function(test) {
+ var expected = 'http://localhost:5732/blah';
+ var request = httpMocks.createRequest({ url: expected });
+ test.equal(request.url, request.originalUrl);
+ test.done();
+};
+
+exports['originalUrl - Default value (with url and originalUrl options set)'] = function(test) {
+ var url = 'http://localhost:5732/blah';
+ var originalUrl = 'http://original/blah';
+ var request = httpMocks.createRequest({ url: url, originalUrl: originalUrl });
+ test.equal(url, request.url);
+ test.equal(originalUrl, request.originalUrl);
+ test.done();
+};
+
+exports['originalUrl - Setting using ._setOriginalUrl()'] = function(test) {
+ var request = httpMocks.createRequest();
+ var expected = 'http://localhost:5732/blah';
+ request._setOriginalUrl(expected);
+ test.equal(expected, request.originalUrl);
+ test.done();
+};
+
+ exports['get/header - Setting a header using options'] = function(test) {
+ var name = 'accept';
+ var value = 'text/plain';
+ var options = { headers: {} };
+ options.headers[name] = value;
+ var request = httpMocks.createRequest(options);
+ test.equal(request.get(name), value);
+ test.done();
+ };
+
+ exports['get/header - Setting a header using ._setHeadersVariable()'] = function(test) {
+ var request = httpMocks.createRequest();
+ var name = 'accept';
+ var value = 'text/plain';
+ request._setHeadersVariable(name, value);
+ test.equal(request.get(name), value);
+ test.equal(request.header(name), value);
+ test.done();
+ };
+
+ exports['get/header - Setting header "referer" edge-case'] = function(test) {
+ var request = httpMocks.createRequest();
+ var name = 'referer';
+ var value = 'http://localhost:5732/blah';
+ request._setHeadersVariable(name, value);
+ test.equal(request.get('referer'), value);
+ test.equal(request.get('referrer'), value);
+ test.equal(request.header('referer'), value);
+ test.equal(request.header('referrer'), value);
+ test.done();
+ };
+
+ exports['get/header - Setting header "referrer" edge-case'] = function(test) {
+ var request = httpMocks.createRequest();
+ var name = 'referrer';
+ var value = 'http://localhost:5732/blah';
+ request._setHeadersVariable(name, value);
+ test.equal(request.get('referer'), value);
+ test.equal(request.get('referrer'), value);
+ test.equal(request.header('referer'), value);
+ test.equal(request.header('referrer'), value);
+ test.done();
+ };
+
exports['addBody - Simple verification'] = function(test) {
var request = httpMocks.createRequest();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git
More information about the Pkg-javascript-commits
mailing list