[Pkg-javascript-commits] [node-mocks-http] 121/296: added tests for mockResponse.sendStatus()

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:27 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 86af302dd871a2f0bfee6b149d713db826ee01a6
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Thu Mar 19 00:45:23 2015 +0800

    added tests for mockResponse.sendStatus()
---
 test/test-mockResponse.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/test-mockResponse.js b/test/test-mockResponse.js
index 3a93e1b..41903f1 100644
--- a/test/test-mockResponse.js
+++ b/test/test-mockResponse.js
@@ -413,3 +413,20 @@ exports['type - set "Content-Type" response header with .contentType()'] = funct
   test.equal('image/png', response.getHeader('Content-Type'));
   test.done();
 };
+
+exports['send - response "Status Code" with .sendStatus()'] = function(test) {
+  var http = require('../lib/node/http');
+  var response, statusCode;
+
+  for (statusCode in http.STATUS_CODES) {
+    response = httpMocks.createResponse();
+    response.sendStatus(statusCode);
+    test.equal(response._getStatusCode(), statusCode);
+    test.equal(response._getData(), http.STATUS_CODES[statusCode]);
+    // uncomment after fixing bug in .send()
+    // test.ok(response._isEndCalled());
+    response = null;
+  }
+
+  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