Permalink
Browse files

failing test; toObject on doc array with nulls

  • Loading branch information...
1 parent 2b33819 commit 639f9ae2ceb92318f887bc4fa1304a1e282726cc @aheckmann aheckmann committed Oct 13, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/types.documentarray.test.js
@@ -103,6 +103,30 @@ module.exports = {
var a = new MongooseDocumentArray([sub3]);
a.id(id3).title.should.equal('rock-n-roll');
a.id(sub3._id).title.should.equal('rock-n-roll');
+ },
+
+ 'inspect works with bad data': function () {
+ var threw = false;
+ var a = new MongooseDocumentArray([null]);
+ try {
+ a.inspect();
+ } catch (err) {
+ threw = true;
+ console.error(err.stack);
+ }
+ threw.should.be.false;
+ },
+
+ 'toObject works with bad data': function () {
+ var threw = false;
+ var a = new MongooseDocumentArray([null]);
+ try {
+ a.toObject();
+ } catch (err) {
+ threw = true;
+ console.error(err.stack);
+ }
+ threw.should.be.false;
}
};

0 comments on commit 639f9ae

Please sign in to comment.