6530ce27fe
End statements with semicolons, to be consistent with the surrounding code. Added a new unit test to ensure environment variables are honored when parsing a connection string. Added a TODO to cleanup a test that emits messages using console.log(). Correct a query's syntax. Looks like a good thing to do even though the syntax doesn't matter in mocked out tests. Removed a test that tests for SELECT tags; AFAIK, SELECT commands don't emit a tag.
24 lines
731 B
JavaScript
24 lines
731 B
JavaScript
var helper = require(__dirname + '/test-helper');
|
|
var net = require('net');
|
|
var pg = require('../../..//lib/index.js');
|
|
|
|
/* console.log() messages show up in `make test` output. TODO: fix it. */
|
|
var server = net.createServer(function(c) {
|
|
console.log('server connected');
|
|
c.destroy();
|
|
console.log('server socket destroyed.');
|
|
server.close(function() { console.log('server closed'); });
|
|
});
|
|
|
|
server.listen(7777, function() {
|
|
console.log('server listening');
|
|
var client = new pg.Client('postgres://localhost:7777');
|
|
console.log('client connecting');
|
|
client.connect(assert.calls(function(err) {
|
|
if (err) console.log("Error on connect: "+err);
|
|
else console.log('client connected');
|
|
assert(err);
|
|
}));
|
|
|
|
});
|