2010-10-24 12:12:02 +08:00
|
|
|
var helper = require(__dirname + '/test-helper');
|
|
|
|
//http://www.postgresql.org/docs/8.3/static/libpq-notify.html
|
|
|
|
test('recieves notification from same connection with no payload', function() {
|
|
|
|
helper.connect(function(con) {
|
|
|
|
con.query('LISTEN boom');
|
2010-11-01 03:43:10 +08:00
|
|
|
assert.emits(con, 'readyForQuery', function() {
|
2010-10-24 12:12:02 +08:00
|
|
|
con.query("NOTIFY boom");
|
2010-11-01 03:43:10 +08:00
|
|
|
assert.emits(con, 'notification', function(msg) {
|
2010-10-24 12:12:02 +08:00
|
|
|
assert.equal(msg.payload, "");
|
|
|
|
assert.equal(msg.channel, 'boom')
|
|
|
|
con.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|