Permalink
Browse files

feat(): add a test case for #34

  • Loading branch information...
XadillaX committed Jan 16, 2016
1 parent a4eeabb commit 57daa4148df972777a1bc8308151458768e0bbe3
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/issues.js
@@ -82,6 +82,23 @@ describe("issues", function () {
});
});

describe("error", function() {
it("should fix #34, Model.count 的时候,在 callback 函数里面 throw Error 会触发两次 callback", function(done) {
var originalException = process.listeners("uncaughtException").pop();
process.removeListener("uncaughtException", originalException);
process.once("uncaughtException", function(err) {

This comment has been minimized.

@plusmancn

plusmancn Jan 19, 2016

如果 originalException 为 undefined,那么 removeListener 的时候,会报错

TypeError: listener must be a function
err.message.should.be.eql("0");
process.on("uncaughtException", originalException);
done();
});

var i = 0;
Model.count(function() {
throw new Error(i++);
});
});
});

describe("generate", function() {
it("should fix #32, 逻辑运算 AND 或者 OR 的时候有 NULL 时发生的 Bug", function(done) {
var sql = Model.where({ key1: { $neq: [ 0, null ] } }).makeSQL("find");

0 comments on commit 57daa41

Please sign in to comment.