X-Git-Url: http://git.squeep.com/?p=squeep-api-dingus;a=blobdiff_plain;f=test%2Flib%2Fdingus.js;h=b478a454aa3eb5b4b3ad8027382e4f5f23bd0681;hp=23b7e8c4a834fad503664b0c9bb0d3ab00bee7e4;hb=4ec136ae8257a1a9f40d83ad61c57954226e79e0;hpb=21c492b52444c5c95db2913d7429e281384a469f diff --git a/test/lib/dingus.js b/test/lib/dingus.js index 23b7e8c..b478a45 100644 --- a/test/lib/dingus.js +++ b/test/lib/dingus.js @@ -269,7 +269,7 @@ describe('Dingus', function () { }; ctx = {}; }); - it('collects body without writing', function () { + it('collects response without writing', function () { Dingus.setHeadHandler(req, res, ctx); res.write(Buffer.from('foo')); res.write('baz'); @@ -277,6 +277,16 @@ describe('Dingus', function () { res.end('quux'); assert(!origWrite.called); assert(origEnd.called); + assert.deepStrictEqual(ctx.responseBody, undefined); + }); + it('collects response without writing, persists written data', function () { + Dingus.setHeadHandler(req, res, ctx, true); + res.write(Buffer.from('foo')); + res.write('baz'); + res.write(); + res.end('quux'); + assert(!origWrite.called); + assert(origEnd.called); assert.deepStrictEqual(ctx.responseBody, Buffer.from('foobazquux')); }); it('ignores non-head method', function () {