[Pkg-javascript-commits] [node-mocks-http] 148/296: Merge branch 'hotfix/1.2.7'
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:31 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 cb3d711e0fc9c53a6a49a77bdb1961e69bca8309
Merge: 019d5e2 42a3d07
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date: Tue Mar 24 15:01:12 2015 +0800
Merge branch 'hotfix/1.2.7'
lib/mockRequest.js | 23 ++++++++++++++++++-
package.json | 2 +-
test/test-mockRequest.js | 59 +++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 74 insertions(+), 10 deletions(-)
diff --cc lib/mockRequest.js
index 35a4f7b,ef18631..9c25d12
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@@ -43,11 -42,15 +43,16 @@@ function createRequest(options)
mockRequest.method = (options.method) ? options.method : 'GET';
mockRequest.url = (options.url) ? options.url : '';
+ mockRequest.originalUrl = options.originalUrl || mockRequest.url;
mockRequest.path = (options.url) ? url.parse(options.url).pathname : '';
mockRequest.params = (options.params) ? options.params : {};
- mockRequest.session = (options.session) ? options.session : {};
+ if (options.session) {
+ mockRequest.session = options.session;
+ }
mockRequest.cookies = (options.cookies) ? options.cookies : {};
+ if (options.signedCookies) {
+ mockRequest.signedCookies = options.signedCookies;
+ }
mockRequest.headers = (options.headers) ? options.headers : {};
mockRequest.body = (options.body) ? options.body : {};
mockRequest.query = (options.query) ? options.query : {};
diff --cc package.json
index 0770f3e,99ed570..d544269
--- 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.6",
+ "version": "1.2.7",
"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 7d07161,db2a176..ccf1452
--- a/test/test-mockRequest.js
+++ b/test/test-mockRequest.js
@@@ -170,11 -159,14 +191,15 @@@ exports['Object creation - Most values
}
});
- test.equal(methodValue, request.method);
- test.equal(urlValue, request.url);
- test.equal(urlValue, request.originalUrl);
- test.equal(idValue, request.params.id);
- test.equal(usernameValue, request.body.username);
+ test.equal(request.method, methodValue);
+ test.equal(request.url, urlValue);
++ test.equal(request.originalUrl, urlValue);
+ test.equal(request.params.id, idValue);
+ test.deepEqual(request.session, {});
+ test.equal(request.cookies.name, 'value');
+ test.equal(request.signedCookies.name, 'value');
+ test.equal(request.header('name'), 'value');
+ test.equal(request.body.username, usernameValue);
test.done();
};
--
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