[Pkg-javascript-commits] [node-mocks-http] 92/296: added tests for mockRequest.originalUrl
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:24 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 72c789d09f31f3e4c3206dc7b0e6dc91c74e59db
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date: Sun Mar 8 00:40:51 2015 +0800
added tests for mockRequest.originalUrl
---
test/test-mockRequest.js | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/test/test-mockRequest.js b/test/test-mockRequest.js
index e08a878..d6b4fcb 100644
--- a/test/test-mockRequest.js
+++ b/test/test-mockRequest.js
@@ -47,6 +47,36 @@ exports['url - Setting a POST'] = function(test) {
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['addBody - Simple verification'] = function(test) {
var request = httpMocks.createRequest();
@@ -96,6 +126,7 @@ exports['Object creation - All values set'] = function(test) {
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.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