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

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 9ecfa5974c6a234e03960a8cf25e5252ac475c9f
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Sat Mar 7 17:15:12 2015 +0800

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

diff --git a/test/test-mockResponse.js b/test/test-mockResponse.js
index ffd44dd..1321bb1 100644
--- a/test/test-mockResponse.js
+++ b/test/test-mockResponse.js
@@ -379,3 +379,35 @@ exports['send - sending response objects a.k.a restifyError without statusCode']
   test.equal('I just dont like you', response._getData().message);
   test.done();
 };
+
+exports['type - set "Content-Type" response header with .type()'] = function(test) {
+  var response = httpMocks.createResponse();
+
+  response.type('.html');
+  test.equal('text/html', response.getHeader('Content-Type'));
+  response.type('html');
+  test.equal('text/html', response.getHeader('Content-Type'));
+  response.type('json');
+  test.equal('application/json', response.getHeader('Content-Type'));
+  response.type('application/json');
+  test.equal('application/json', response.getHeader('Content-Type'));
+  response.type('png');
+  test.equal('image/png', response.getHeader('Content-Type'));
+  test.done();
+};
+
+exports['type - set "Content-Type" response header with .contentType()'] = function(test) {
+  var response = httpMocks.createResponse();
+
+  response.contentType('.html');
+  test.equal('text/html', response.getHeader('Content-Type'));
+  response.contentType('html');
+  test.equal('text/html', response.getHeader('Content-Type'));
+  response.contentType('json');
+  test.equal('application/json', response.getHeader('Content-Type'));
+  response.contentType('application/json');
+  test.equal('application/json', response.getHeader('Content-Type'));
+  response.contentType('png');
+  test.equal('image/png', response.getHeader('Content-Type'));
+  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