node-postgres/test/unit/connection/error-tests.js
2011-09-21 14:34:02 -05:00

11 lines
382 B
JavaScript

var helper = require(__dirname + '/test-helper');
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) {
assert.equal(err.message, "OMG!");
});
con.connect();
con.stream.emit('error', new Error("OMG!"));
});