make tests pass on pg@8.4.9

This commit is contained in:
brianc 2013-04-17 10:29:21 -05:00
parent 01f3f3da53
commit 3f5df0afa2
3 changed files with 23 additions and 21 deletions

View File

@ -8,7 +8,7 @@ var Result = function() {
this.rows = [];
};
var matchRegexp = /([A-Za-z]+) (\d+ )?(\d+)?/;
var matchRegexp = /([A-Za-z]+) ?(\d+ )?(\d+)?/;
//adds a command complete message
Result.prototype.addCommandComplete = function(msg) {

View File

@ -21,7 +21,7 @@ test('error during query execution', function() {
var killIdleQuery = "SELECT " + pidColName + ", (SELECT pg_terminate_backend(" + pidColName + ")) AS killed FROM pg_stat_activity WHERE " + queryColName + " = $1";
client2.query(killIdleQuery, [sleepQuery], assert.calls(function(err, res) {
assert.ifError(err);
assert.equal(res.rowCount, 1);
assert.equal(res.rows.length, 1);
client2.end();
assert.emits(client2, 'end');
}));

View File

@ -5,29 +5,31 @@ test('should return insert metadata', function() {
pg.connect(helper.config, assert.calls(function(err, client, done) {
assert.isNull(err);
client.query("CREATE TEMP TABLE zugzug(name varchar(10))", assert.calls(function(err, result) {
assert.isNull(err);
assert.equal(result.oid, null);
assert.equal(result.command, 'CREATE');
helper.versionGTE(client, '9.0.0', assert.success(function(hasRowCount) {
client.query("CREATE TEMP TABLE zugzug(name varchar(10))", assert.calls(function(err, result) {
assert.isNull(err);
assert.equal(result.oid, null);
assert.equal(result.command, 'CREATE');
var q = client.query("INSERT INTO zugzug(name) VALUES('more work?')", assert.calls(function(err, result) {
assert.equal(result.command, "INSERT");
assert.equal(result.rowCount, 1);
client.query('SELECT * FROM zugzug', assert.calls(function(err, result) {
assert.isNull(err);
var q = client.query("INSERT INTO zugzug(name) VALUES('more work?')", assert.calls(function(err, result) {
assert.equal(result.command, "INSERT");
assert.equal(result.rowCount, 1);
assert.equal(result.command, 'SELECT');
process.nextTick(pg.end.bind(pg));
client.query('SELECT * FROM zugzug', assert.calls(function(err, result) {
assert.isNull(err);
if(hasRowCount) assert.equal(result.rowCount, 1);
assert.equal(result.command, 'SELECT');
process.nextTick(pg.end.bind(pg));
}));
}));
assert.emits(q, 'end', function(result) {
assert.equal(result.command, "INSERT");
if(hasRowCount) assert.equal(result.rowCount, 1);
done();
});
}));
assert.emits(q, 'end', function(result) {
assert.equal(result.command, "INSERT");
assert.equal(result.rowCount, 1);
done();
});
}));
}));
});