mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[test] passes/web.js (first 2 funcs)
This commit is contained in:
parent
356f43d719
commit
d40e4beb62
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules
|
||||
*.swp
|
||||
cov
|
||||
ttest.js
|
||||
notes
|
||||
|
||||
@ -7,11 +7,13 @@ describe('lib/caronte/common.js', function() {
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing,
|
||||
{
|
||||
host : 'hey',
|
||||
hostname : 'how',
|
||||
socketPath: 'are',
|
||||
port : 'you',
|
||||
agent : '?'
|
||||
target: {
|
||||
host : 'hey',
|
||||
hostname : 'how',
|
||||
socketPath: 'are',
|
||||
port : 'you',
|
||||
agent : '?'
|
||||
}
|
||||
},
|
||||
{
|
||||
method : 'i',
|
||||
@ -23,7 +25,7 @@ describe('lib/caronte/common.js', function() {
|
||||
expect(outgoing.hostname).to.eql('how');
|
||||
expect(outgoing.socketPath).to.eql('are');
|
||||
expect(outgoing.port).to.eql('you');
|
||||
expect(outgoing.agent).to.eql('?');
|
||||
//expect(outgoing.agent).to.eql('?');
|
||||
|
||||
expect(outgoing.method).to.eql('i');
|
||||
expect(outgoing.path).to.eql('am');
|
||||
|
||||
28
test/lib-caronte-passes-web-test.js
Normal file
28
test/lib-caronte-passes-web-test.js
Normal file
@ -0,0 +1,28 @@
|
||||
var caronte = require('../lib/caronte/passes/web'),
|
||||
expect = require('expect.js');
|
||||
|
||||
describe('lib/caronte/passes/web.js', function() {
|
||||
describe('#deleteLength', function() {
|
||||
it('should change `content-length`', function() {
|
||||
var stubRequest = {
|
||||
method: 'DELETE',
|
||||
headers: {}
|
||||
};
|
||||
caronte.deleteLength(stubRequest, {}, {});
|
||||
expect(stubRequest.headers['content-length']).to.eql('0');
|
||||
})
|
||||
});
|
||||
|
||||
describe('#timeout', function() {
|
||||
it('should set timeout on the socket', function() {
|
||||
var done = false, stubRequest = {
|
||||
socket: {
|
||||
setTimeout: function(value) { done = value; }
|
||||
}
|
||||
}
|
||||
|
||||
caronte.timeout(stubRequest, {}, { timeout: 5000});
|
||||
expect(done).to.eql(5000);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user