mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
fix test to work with 8.x versions of postgres
This commit is contained in:
parent
e4ce36bda8
commit
0792c0a51b
@ -16,20 +16,28 @@ test('emits notify message', function() {
|
||||
client.query('LISTEN boom', assert.calls(function() {
|
||||
var otherClient = helper.client();
|
||||
otherClient.query('LISTEN boom', assert.calls(function() {
|
||||
client.query("NOTIFY boom, 'omg!'");
|
||||
assert.emits(client, 'notification', function(msg) {
|
||||
|
||||
//make sure PQfreemem doesn't invalidate string pointers
|
||||
setTimeout(function() {
|
||||
assert.equal(msg.channel, 'boom');
|
||||
assert.ok(msg.payload == 'omg!' /*9.x*/ || msg.payload == '' /*8.x*/, "expected blank payload or correct payload but got " + msg.message)
|
||||
client.end()
|
||||
}, 500)
|
||||
var afterNotify = function() {
|
||||
assert.emits(client, 'notification', function(msg) {
|
||||
|
||||
});
|
||||
assert.emits(otherClient, 'notification', function(msg) {
|
||||
assert.equal(msg.channel, 'boom');
|
||||
otherClient.end();
|
||||
//make sure PQfreemem doesn't invalidate string pointers
|
||||
setTimeout(function() {
|
||||
assert.equal(msg.channel, 'boom');
|
||||
assert.ok(msg.payload == 'omg!' /*9.x*/ || msg.payload == '' /*8.x*/, "expected blank payload or correct payload but got " + msg.message)
|
||||
client.end()
|
||||
}, 500)
|
||||
|
||||
});
|
||||
assert.emits(otherClient, 'notification', function(msg) {
|
||||
assert.equal(msg.channel, 'boom');
|
||||
otherClient.end();
|
||||
});
|
||||
}
|
||||
client.query("NOTIFY boom, 'omg!'", function(err, q) {
|
||||
if(err) {
|
||||
//notify not supported with payload on 8.x
|
||||
client.query("NOTIFY boom")
|
||||
}
|
||||
afterNotify();
|
||||
});
|
||||
}));
|
||||
}));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user