Comparing version 0.2.0 to 0.2.1
@@ -66,3 +66,4 @@ var path = require('path') | ||
, paused | ||
, next = []; | ||
, next = [] | ||
, callnext; | ||
@@ -69,0 +70,0 @@ requestBody = requestBodyBuffers.map(function(buffer) { |
{ "name" : "nock" | ||
, "description" : "HTTP Server mocking for Node.js" | ||
, "tags" : ["Mock", "HTTP", "testing", "isolation"] | ||
, "version" : "0.2.0" | ||
, "version" : "0.2.1" | ||
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>" | ||
, "contributors" : | ||
[ "Roly Fentanes" | ||
] | ||
, "repository" : | ||
@@ -7,0 +10,0 @@ { "type" : "git" |
@@ -530,1 +530,40 @@ var nock = require('../.') | ||
}); | ||
tap.test("chaining API", function(t) { | ||
var scope = nock('http://chainchomp.com') | ||
.get('/one') | ||
.reply(200, 'first one') | ||
.get('/two') | ||
.reply(200, 'second one'); | ||
http.get({ | ||
host: 'chainchomp.com' | ||
, path: '/one' | ||
}, function(res) { | ||
res.setEncoding('utf8'); | ||
t.equal(res.statusCode, 200, 'status should be ok'); | ||
res.on('data', function(data) { | ||
t.equal(data, 'first one', 'should be equal to first reply'); | ||
}); | ||
res.on('end', function() { | ||
http.get({ | ||
host: 'chainchomp.com' | ||
, path: '/two' | ||
}, function(res) { | ||
res.setEncoding('utf8'); | ||
t.equal(res.statusCode, 200, 'status should be ok'); | ||
res.on('data', function(data) { | ||
t.equal(data, 'second one', 'should be qual to second reply'); | ||
}); | ||
res.on('end', function() { | ||
scope.done(); | ||
t.end(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
25664
749