From 39b0c46a6967fda5329760ad93a8ec01bc4a6f14 Mon Sep 17 00:00:00 2001 From: srossross Date: Tue, 17 Sep 2013 15:29:48 -0700 Subject: [PATCH] TEST: added agent and header tests --- test/lib-caronte-common-test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/lib-caronte-common-test.js b/test/lib-caronte-common-test.js index 88536e2..ac79867 100644 --- a/test/lib-caronte-common-test.js +++ b/test/lib-caronte-common-test.js @@ -13,12 +13,13 @@ describe('lib/caronte/common.js', function () { hostname : 'how', socketPath: 'are', port : 'you', - } + }, + headers: {'fizz': 'bang', 'overwritten':true}, }, { method : 'i', url : 'am', - headers : 'proxy' + headers : {'pro':'xy','overwritten':false} }); expect(outgoing.host).to.eql('hey'); @@ -29,7 +30,16 @@ describe('lib/caronte/common.js', function () { expect(outgoing.method).to.eql('i'); expect(outgoing.path).to.eql('am'); - expect(outgoing.headers).to.eql('proxy') + + expect(outgoing.headers.pro).to.eql('xy'); + expect(outgoing.headers.fizz).to.eql('bang'); + expect(outgoing.headers.overwritten).to.eql(true); + }); + + it('should set the agent to false if none is given', function () { + var outgoing = {}; + common.setupOutgoing(outgoing, {target: {},}, {}); + expect(outgoing.agent).to.eql(false); }); it('set the port according to the protocol', function () {