-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Got simple tests for complex requests (i.e. requests as object…
…s) working
- Loading branch information
Showing
3 changed files
with
67 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* complex-request-test.js: Tests for complex requests using HttpAgent | ||
* | ||
* (C) 2010 Charlie Robbins | ||
* MIT LICENSE | ||
* | ||
*/ | ||
|
||
var path = require('path'), | ||
sys = require('sys'), | ||
http = require('http'), | ||
events = require('events'), | ||
assert = require('assert'), | ||
eyes = require('eyes'), | ||
net = require('net'), | ||
vows = require('vows'); | ||
|
||
require.paths.unshift(path.join(__dirname, '..', 'lib')); | ||
|
||
var httpAgent = require('http-agent'), | ||
helpers = require('./helpers'); | ||
|
||
var complexUrls = [ | ||
{ | ||
method: 'GET', | ||
url: 'barackobama' | ||
}, | ||
{ | ||
method: 'GET', | ||
url: 'facebook' | ||
}, | ||
{ | ||
method: 'GET', | ||
url: 'google' | ||
} | ||
]; | ||
|
||
vows.describe('httpAgent').addBatch({ | ||
"When using an httpAgent": { | ||
"to browse a path of complex urls": { | ||
"the next event": { | ||
topic: function () { | ||
var agent = helpers.createAgent({ urls: complexUrls }); | ||
agent.addListener('next', this.callback); | ||
agent.start(); | ||
}, | ||
"should be raised after start": function (e, agent) { | ||
assert.instanceOf(agent, httpAgent.HttpAgent); | ||
assert.isNotNull(agent.response); | ||
} | ||
} | ||
} | ||
} | ||
}).export(module); |
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