From c75c6e304035f45997cc773975212e7e3968198a Mon Sep 17 00:00:00 2001 From: Brian Carlson Date: Thu, 14 Apr 2011 23:20:15 -0500 Subject: [PATCH] fix failing test on 9.0 due to the 'instant' nature of notification messages --- test/integration/client/notice-tests.js | 31 +++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/test/integration/client/notice-tests.js b/test/integration/client/notice-tests.js index 9071ebdd..44d7abad 100644 --- a/test/integration/client/notice-tests.js +++ b/test/integration/client/notice-tests.js @@ -16,28 +16,25 @@ test('emits notify message', function() { client.query('LISTEN boom', assert.calls(function() { var otherClient = helper.client(); otherClient.query('LISTEN boom', assert.calls(function() { - var afterNotify = function() { - 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) - - }); - assert.emits(otherClient, 'notification', function(msg) { + assert.emits(client, 'notification', function(msg) { + //make sure PQfreemem doesn't invalidate string pointers + setTimeout(function() { assert.equal(msg.channel, 'boom'); - otherClient.end(); - }); - } + 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(); + } }); })); }));