From 04dfa9deef77201960fc596db2799eb7c9e0bd78 Mon Sep 17 00:00:00 2001 From: spalger Date: Tue, 5 Jan 2016 10:09:13 -0700 Subject: [PATCH] add some tests to make sure the createNodeAgent config works --- test/unit/specs/http_connector.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/specs/http_connector.js b/test/unit/specs/http_connector.js index 1a9b3c9e0..c9ee86f2b 100644 --- a/test/unit/specs/http_connector.js +++ b/test/unit/specs/http_connector.js @@ -64,6 +64,17 @@ describe('Http Connector', function () { var con = new HttpConnection(new Host('thrifty://es.com/stuff')); }).to.throwError(/invalid protocol/i); }); + + it('allows defining a custom agent', function () { + var football = {}; + var con = new HttpConnection(new Host(), { createNodeAgent: _.constant(football) }); + expect(con.agent).to.be(football); + }); + + it('allows setting agent to false', function () { + var con = new HttpConnection(new Host(), { createNodeAgent: _.constant(false) }); + expect(con.agent).to.be(false); + }); }); describe('#makeReqParams', function () {