-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test suite for non-RFC proxy servers
- Loading branch information
1 parent
5e0bfa4
commit bb95adb
Showing
3 changed files
with
110 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,45 @@ | ||
var helper = require('./shared/setup.js'), | ||
suites = require('./shared/suites.js'), | ||
async = require('async'), | ||
util = require('util'); | ||
suites = require('./shared/suites.js'); | ||
|
||
var scenarios = [ | ||
{ context: 'using direct connections to endpoints', connection: 'direct' }, | ||
{ context: 'via a downstream proxy', connection: 'proxy' }, | ||
{ context: 'via a downstream non-RFC proxy', connection: 'not-rfc-proxy' } | ||
]; | ||
|
||
describe('the proxy server', function() { | ||
context('using a basic config', function() { | ||
var config = {}, | ||
proxyPort; | ||
|
||
before(function(done) { | ||
helper.setup(config, function(err, port) { | ||
if (err) throw err; | ||
proxyPort = port; | ||
done(); | ||
scenarios.forEach(function(scenario) { | ||
context(scenario.context, function() { | ||
var proxyPort; | ||
|
||
before(function(done) { | ||
helper.setup(scenario.connection, function(err, port) { | ||
if (err) throw err; | ||
proxyPort = port; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
// needed to setup the shared context for the proxyPort and tempDir | ||
beforeEach(function(done) { | ||
this.proxyPort = proxyPort; | ||
done(); | ||
}) | ||
|
||
suites.run(); | ||
|
||
after(function(done) { | ||
helper.cleanup(done); | ||
}) | ||
}); | ||
|
||
context('using another LAN proxy server', function() { | ||
var proxyPort; | ||
|
||
before(function(done) { | ||
helper.setup({ useLanProxy: true }, function(err, port) { | ||
if (err) throw err; | ||
proxyPort = port; | ||
// needed to setup the shared context for the proxyPort and tempDir | ||
beforeEach(function(done) { | ||
this.proxyPort = proxyPort; | ||
done(); | ||
}); | ||
}); | ||
}) | ||
|
||
// needed to setup the shared context for the proxyPort and tempDir | ||
beforeEach(function(done) { | ||
this.proxyPort = proxyPort; | ||
done(); | ||
}) | ||
suites.run(); | ||
|
||
suites.run(); | ||
|
||
after(function(done) { | ||
helper.cleanup(done); | ||
}) | ||
after(function(done) { | ||
helper.cleanup(done); | ||
}) | ||
}); | ||
}); | ||
|
||
after(function(){ | ||
after(function(done) { | ||
var nock = require('nock'); | ||
nock.enableNetConnect(); | ||
nock.cleanAll(); | ||
nock.restore(); | ||
done(); | ||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters