added tests for #25

This commit is contained in:
Spencer Alger
2014-01-14 10:48:07 -07:00
parent d7c278f162
commit 6de9243fda

View File

@ -8,6 +8,7 @@ describe('Http Connector', function () {
var nock = require('nock');
var sinon = require('sinon');
var util = require('util');
var KeepAliveAgent = require('agentkeepalive');
var http = require('http');
var https = require('https');
@ -55,7 +56,7 @@ describe('Http Connector', function () {
// requestTimeout
});
it('expects one the host to have a protocol of http or https', function () {
it('expects the host to have a protocol of http or https', function () {
(function () {
var con = new HttpConnection(new Host('thrifty://es.com/stuff'));
}).should.throw(/invalid protocol/i);
@ -175,6 +176,7 @@ describe('Http Connector', function () {
con.request({}, function () {
http.request.callCount.should.eql(1);
https.request.callCount.should.eql(0);
http.request.lastCall.args[0].agent.should.be.an.instanceOf(KeepAliveAgent);
done();
});
});
@ -184,6 +186,7 @@ describe('Http Connector', function () {
con.request({}, function () {
http.request.callCount.should.eql(0);
https.request.callCount.should.eql(1);
https.request.lastCall.args[0].agent.should.be.an.instanceOf(KeepAliveAgent.HttpsAgent);
done();
});
});