fixed the force closing of the forever agent, which was removing items from the same array it was itterating.

This commit is contained in:
Spencer Alger
2014-02-17 01:11:53 -07:00
parent b19f7b7825
commit 697c761b71
2 changed files with 32 additions and 12 deletions

View File

@ -389,6 +389,25 @@ describe('Http Connector', function () {
done();
}));
});
it('properly removes all elements from the socket', function () {
var con = new HttpConnection(new Host('localhost'));
var sockets = [
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} },
{ destroy: function () {} }
];
con.agent.sockets['http://localhost/'] = sockets;
con.setStatus('closed');
expect(sockets).to.eql([]);
});
});
});