node-postgres/test/integration/connection/notification-tests.js

16 lines
523 B
JavaScript
Raw Normal View History

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');
assert.emits(con, 'readyForQuery', function() {
2010-10-24 12:12:02 +08:00
con.query("NOTIFY boom");
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();
});
});
});
});