Skip to content

Commit 0792c0a

Browse files
committed
fix test to work with 8.x versions of postgres
1 parent e4ce36b commit 0792c0a

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

test/integration/client/notice-tests.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,28 @@ test('emits notify message', function() {
1616
client.query('LISTEN boom', assert.calls(function() {
1717
var otherClient = helper.client();
1818
otherClient.query('LISTEN boom', assert.calls(function() {
19-
client.query("NOTIFY boom, 'omg!'");
20-
assert.emits(client, 'notification', function(msg) {
21-
22-
//make sure PQfreemem doesn't invalidate string pointers
23-
setTimeout(function() {
24-
assert.equal(msg.channel, 'boom');
25-
assert.ok(msg.payload == 'omg!' /*9.x*/ || msg.payload == '' /*8.x*/, "expected blank payload or correct payload but got " + msg.message)
26-
client.end()
27-
}, 500)
19+
var afterNotify = function() {
20+
assert.emits(client, 'notification', function(msg) {
2821

29-
});
30-
assert.emits(otherClient, 'notification', function(msg) {
31-
assert.equal(msg.channel, 'boom');
32-
otherClient.end();
22+
//make sure PQfreemem doesn't invalidate string pointers
23+
setTimeout(function() {
24+
assert.equal(msg.channel, 'boom');
25+
assert.ok(msg.payload == 'omg!' /*9.x*/ || msg.payload == '' /*8.x*/, "expected blank payload or correct payload but got " + msg.message)
26+
client.end()
27+
}, 500)
28+
29+
});
30+
assert.emits(otherClient, 'notification', function(msg) {
31+
assert.equal(msg.channel, 'boom');
32+
otherClient.end();
33+
});
34+
}
35+
client.query("NOTIFY boom, 'omg!'", function(err, q) {
36+
if(err) {
37+
//notify not supported with payload on 8.x
38+
client.query("NOTIFY boom")
39+
}
40+
afterNotify();
3341
});
3442
}));
3543
}));

0 commit comments

Comments
 (0)