Skip to content

Commit

Permalink
Added test for document JSONification
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Feb 9, 2011
1 parent b3d3925 commit 67a25aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/document.test.js
Expand Up @@ -435,6 +435,20 @@ module.exports = {
beforeExit(function () {
called.should.be.true;
});
},

'test jsonifying an object': function () {
var doc = new TestDocument({ test: 'woot' })
, oidString = DocumentObjectId.toString(doc._id);

// convert to json string
var json = JSON.stringify(doc);

// parse again
var obj = JSON.parse(json);

obj.test.should.eql('woot');
obj._id.should.eql(oidString);
}

};

0 comments on commit 67a25aa

Please sign in to comment.