failing test for multiple calls of callback when multiple commands are executed
This commit is contained in:
parent
a7083d3bf7
commit
41add49925
@ -6,7 +6,7 @@ var log = function() {
|
||||
//console.log.apply(console, arguments);
|
||||
}
|
||||
|
||||
var sink = new helper.Sink(4, 10000, function() {
|
||||
var sink = new helper.Sink(5, 10000, function() {
|
||||
log("ending connection pool: %s", connectionString);
|
||||
pg.end(connectionString);
|
||||
});
|
||||
@ -92,3 +92,19 @@ test("query errors are handled and do not bubble if callback is provded", functi
|
||||
}))
|
||||
}))
|
||||
})
|
||||
|
||||
test('callback is fired once and only once', function() {
|
||||
pg.connect(connectionString, assert.calls(function(err, client) {
|
||||
assert.isNull(err);
|
||||
client.query("CREATE TEMP TABLE boom(name varchar(10))");
|
||||
var callCount = 0;
|
||||
client.query([
|
||||
"INSERT INTO boom(name) VALUES('hai')",
|
||||
"INSERT INTO boom(name) VALUES('boom')",
|
||||
"INSERT INTO boom(name) VALUES('zoom')",
|
||||
].join(";"), function(err, callback) {
|
||||
assert.equal(callCount++, 0, "Call count should be 0. More means this callback fired more than once.");
|
||||
sink.add();
|
||||
})
|
||||
}))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user