Permalink
Browse files

[test] Added tests for `Error.prototype.toJSON`

  • Loading branch information...
1 parent 1a3116c commit b6d79b9b383f16dbe6aad3dfc04c84a0a9c9fea7 @indexzero committed May 15, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/errs-test.js
View
@@ -146,4 +146,18 @@ vows.describe('errs').addBatch({
}
}
}
+}).addBatch({
+ "Using errs module": {
+ "Error.prototype.toJSON": {
+ "should exist": function () {
+ assert.isFunction(Error.prototype.toJSON);
+
+ var json = (new Error('Testing 12345')).toJSON();
+
+ ['message', 'stack', 'arguments', 'type'].forEach(function (prop) {
+ assert.isObject(Object.getOwnPropertyDescriptor(json, prop));
+ })
+ }
+ }
+ }
}).export(module);

0 comments on commit b6d79b9

Please sign in to comment.