From a5e532f20baff8424006bc0ffd08447d1d8ea4e6 Mon Sep 17 00:00:00 2001 From: jeromew Date: Thu, 28 Jul 2016 22:49:09 +0000 Subject: [PATCH] Bugfix - wrong tests on chunk frontiers --- test/copy-to.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/copy-to.js b/test/copy-to.js index 0982fc8..50bd7c8 100644 --- a/test/copy-to.js +++ b/test/copy-to.js @@ -7,6 +7,7 @@ var concat = require('concat-stream') var pg = require('pg') var copy = require('../').to +var code = require('../message-formats') var client = function() { var client = new pg.Client() @@ -22,6 +23,18 @@ var testConstruction = function() { testConstruction() +var testComparators = function() { + var copy1 = copy(); + copy1.pipe(concat(function(buf) { + assert(copy1._gotCopyOutResponse, 'should have received CopyOutResponse') + assert(!copy1._remainder, 'Message with no additional data (len=Int4Len+0) should not leave a remainder') + })) + copy1.end(new Buffer([code.CopyOutResponse, 0x00, 0x00, 0x00, 0x04])); + + +} +testComparators(); + var testRange = function(top) { var fromClient = client() var txt = 'COPY (SELECT * from generate_series(0, ' + (top - 1) + ')) TO STDOUT'