0.8 compatibility
This commit is contained in:
parent
9da158f945
commit
2f44dbf53e
@ -41,7 +41,7 @@ function MockRequest(remoteAddr, method, originalUrl, headers) {
|
|||||||
function MockResponse() {
|
function MockResponse() {
|
||||||
var r = this;
|
var r = this;
|
||||||
this.end = function(chunk, encoding) {
|
this.end = function(chunk, encoding) {
|
||||||
setImmediate(function(){ r.emit('finish') });
|
r.emit('finish');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.writeHead = function(code, headers) {
|
this.writeHead = function(code, headers) {
|
||||||
|
@ -37,7 +37,7 @@ function MockResponse(statusCode) {
|
|||||||
this.statusCode = statusCode;
|
this.statusCode = statusCode;
|
||||||
|
|
||||||
this.end = function(chunk, encoding) {
|
this.end = function(chunk, encoding) {
|
||||||
setImmediate(function(){ r.emit('finish') });
|
r.emit('finish');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
util.inherits(MockResponse, EE);
|
util.inherits(MockResponse, EE);
|
||||||
@ -87,9 +87,12 @@ vows.describe('log4js connect logger').addBatch({
|
|||||||
topic: function(d) {
|
topic: function(d) {
|
||||||
var req = new MockRequest('my.remote.addr', 'GET', 'http://url/hoge.gif'); // gif
|
var req = new MockRequest('my.remote.addr', 'GET', 'http://url/hoge.gif'); // gif
|
||||||
var res = new MockResponse(200);
|
var res = new MockResponse(200);
|
||||||
|
var cb = this.callback;
|
||||||
d.cl(req, res, function() { });
|
d.cl(req, res, function() { });
|
||||||
res.end('chunk', 'encoding');
|
res.end('chunk', 'encoding');
|
||||||
return d.ml.messages;
|
setTimeout(function() {
|
||||||
|
cb(null, d.ml.messages);
|
||||||
|
},10);
|
||||||
},
|
},
|
||||||
'check message': function(messages) {
|
'check message': function(messages) {
|
||||||
assert.isArray(messages);
|
assert.isArray(messages);
|
||||||
|
Loading…
Reference in New Issue
Block a user