Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Include docs on assert module

  • Loading branch information...
commit 69b643edb15d6ac83d1f73fdf4aa45804024e3ac 1 parent 39865ac
@kriszyp authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.md
View
16 README.md
@@ -51,6 +51,22 @@ promised-io's fs module:
};
...
+Asynchronous assert module
+======================
+
+Patr includes an "assert" module (patr/assert) that is upgraded for promise-based asynchronous
+code blocks. In particular, the "throws" method can be used to enforce that a code block
+will eventually throw (or reject) even if it happens asynchronously. For example:
+
+ var assert = require("patr/assert");
+ exports.testFile = function(){
+ return assert.throws(function(){
+ // asserts that this must throw/reject eventually
+ return fs.readFile("non-existent file");
+ });
+ };
+
+
Advanced Testing
============
Please sign in to comment.
Something went wrong with that request. Please try again.