added tests for #25
This commit is contained in:
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user