From 881c7e62e0bef7b4b9f81b6fd121f7ad6641bd77 Mon Sep 17 00:00:00 2001 From: cronopio Date: Mon, 21 Oct 2013 21:22:39 -0500 Subject: [PATCH] [tests] this file is not necessary anymore --- test/lib-http-proxy-integration-test.js | 92 ------------------------- 1 file changed, 92 deletions(-) delete mode 100644 test/lib-http-proxy-integration-test.js diff --git a/test/lib-http-proxy-integration-test.js b/test/lib-http-proxy-integration-test.js deleted file mode 100644 index f6ea706..0000000 --- a/test/lib-http-proxy-integration-test.js +++ /dev/null @@ -1,92 +0,0 @@ -var httpProxy = require('../lib/http-proxy'), - expect = require('expect.js'), - http = require('http'); - - -describe('lib/http-proxy.js', function() { - - describe('#createProxyServer with target options for integration into existing server', function () { - it('should proxy the request using the web proxy handler', function (done) { - var proxy = httpProxy.createProxyServer({ - target: 'http://127.0.0.1:8080' - }); - - function requestHandler(req, res) { - proxy.web(req, res); - } - - var proxyServer = http.createServer(requestHandler); - - var source = http.createServer(function(req, res) { - source.close(); - proxyServer.close(); - expect(req.method).to.eql('GET'); - expect(req.headers.host.split(':')[1]).to.eql('8082'); - done(); - }); - - proxyServer.listen('8082'); - source.listen('8080'); - - http.request('http://127.0.0.1:8082', function() {}).end(); - }); - }); - - describe('#createProxyServer() for integration into existing server with error response', function () { - it('should proxy the request and handle error via callback', function(done) { - var proxy = httpProxy.createProxyServer({ - target: 'http://127.0.0.1:8080' - }); - - var proxyServer = http.createServer(requestHandler); - - function requestHandler(req, res) { - proxy.web(req, res, function (err) { - proxyServer.close(); - expect(err).to.be.an(Error); - expect(err.code).to.be('ECONNREFUSED'); - done(); - }); - } - - proxyServer.listen('8082'); - - http.request({ - hostname: '127.0.0.1', - port: '8082', - method: 'GET', - }, function() {}).end(); - }); - - it('should proxy the request and handle error event listener', function(done) { - var proxy = httpProxy.createProxyServer({ - target: 'http://127.0.0.1:8080' - }); - - var proxyServer = http.createServer(requestHandler); - - function requestHandler(req, res) { - proxy.once('error', function (err, errReq, errRes) { - proxyServer.close(); - expect(err).to.be.an(Error); - expect(errReq).to.be.equal(req); - expect(errRes).to.be.equal(res); - expect(err.code).to.be('ECONNREFUSED'); - done(); - }); - - proxy.web(req, res); - } - - proxyServer.listen('8082'); - - http.request({ - hostname: '127.0.0.1', - port: '8082', - method: 'GET', - }, function() {}).end(); - }); - - }); - -}); \ No newline at end of file