moved more buffers into test buffer file

This commit is contained in:
brianc 2010-10-06 21:39:52 -05:00
parent 9c55891521
commit 3768e43e15
3 changed files with 23 additions and 14 deletions

View File

@ -53,6 +53,6 @@ test('query queue', function() {
client.query('select * from bang');
assert.empty(stream.packets);
stream.emit('data', buffers.ReadyForQuery);
stream.emit('data', buffers.readyForQuery());
assert.equal(stream.packets.length, 1);
});

View File

@ -4,22 +4,15 @@ var PARSE = function(buffer) {
return new Parser(buffer).parse();
};
var authOkBuffer = new BufferList()
.addInt32(8)
.join(true, 'R');
var paramStatusBuffer = new BufferList()
.addCString("client_encoding")
.addCString("UTF8")
.join(true, 'S');
var authOkBuffer = buffers.authenticationOk();
var paramStatusBuffer = buffers.parameterStatus('client_encoding', 'UTF8');
var readyForQueryBuffer = buffers.readyForQuery();
var backendKeyDataBuffer = new BufferList()
.addInt32(1)
.addInt32(2)
.join(true,'K');
var readyForQueryBuffer = buffers.readyForQuery;
var commandCompleteBuffer = new BufferList()
.addCString("SELECT 3")
.join(true,'C');

View File

@ -1,8 +1,24 @@
require(__dirname+'/test-helper');
var buffers = {};
buffers.readyForQuery = new BufferList()
.add(Buffer('I'))
.join(true,'Z');
buffers.readyForQuery = function() {
return new BufferList()
.add(Buffer('I'))
.join(true,'Z');
};
buffers.authenticationOk = function() {
return new BufferList()
.addInt32(8)
.join(true, 'R');
};
buffers.parameterStatus = function(name, value) {
return new BufferList()
.addCString(name)
.addCString(value)
.join(true, 'S');
};
module.exports = buffers;