node-postgres/test/unit/test-helper.js
2010-10-24 22:52:12 -05:00

24 lines
472 B
JavaScript

require(__dirname+'/../test-helper');
MemoryStream = function() {
EventEmitter.call(this);
this.packets = [];
};
sys.inherits(MemoryStream, EventEmitter);
var p = MemoryStream.prototype;
p.write = function(packet) {
this.packets.push(packet);
};
createClient = function() {
var stream = new MemoryStream();
stream.readyState = "open";
var client = new Client({
connection: new Connection({stream: stream})
});
client.connect();
return client;
};