node-postgres/test/unit/connection/error-tests.js

11 lines
382 B
JavaScript
Raw Normal View History

var helper = require(__dirname + '/test-helper');
2011-08-29 15:35:08 +08:00
var Connection = require(__dirname + '/../../../lib/connection');
var con = new Connection({stream: new MemoryStream()});
test("connection emits stream errors", function() {
assert.emits(con, 'error', function(err) {
2011-09-22 03:34:02 +08:00
assert.equal(err.message, "OMG!");
});
con.connect();
2011-09-22 03:34:02 +08:00
con.stream.emit('error', new Error("OMG!"));
});