Skip to content
Browse files

Read that.

  • Loading branch information...
1 parent 5c77169 commit 7a6c0f0078c5d14faf5fad87fd751ab8e6c4fd4b @Yuffster committed
Showing with 63 additions and 0 deletions.
  1. +63 −0 README.md
View
63 README.md
@@ -0,0 +1,63 @@
+# describe
+
+Describe provides a simple method for testing asynchronous and synchronous
+code within JavaScript projects.
+
+## API Documentation
+
+### describe
+
+describe(*groupName*, *tests*[, *options*]);
+
+### Arguments
+
+* *groupName* (string): A human-readable description of the test group.
+* *tests* (object): An object made up of human-readable test descriptions as keys and
+functions to run as tests. Tests functions will be given access to
+`this.expect`.
+* *options*: Configuration options. Possible values:
+ * timeout (int): The max amount of time to wait for a test to run before
+timing out.
+ * callbackMode (string): if set to 'node', this.expect will treat the first
+argument to the callback as an error and the second argument as the result.
+
+### describe.config(*key*, *value*)
+
+Sets the global configuration for tests.
+
+### Synchronous Assertions: this.expect(*subject*, *expected*)
+
+#### Example
+
+ describe("assertions", {
+ 'basic synchronous expectation': function() {
+ this.expect(42, 42);
+ }
+ });
+
+### Asynchronous Assertions: this.expect(*expected*)
+
+
+#### Example: Basic Callbacks
+
+ function addNumbersAsync(a, b, callback) {
+ callback(a+b);
+ }
+
+ describe("assertions", {
+ 'basic asynchronous expectation': function() {
+ addNumbersAsync(2, 2, this.expect(4));
+ }
+ });
+
+#### Example: Node.js-style (e, data) Callbacks
+
+ function addNumbersAsync(a, b, callback) {
+ callback(null, a+b);
+ }
+
+ describe("assertions", {
+ 'basic asynchronous expectation': function() {
+ addNumbersAsync(2, 2, this.expect(4));
+ }
+ }, { callbackMode: 'node' });

0 comments on commit 7a6c0f0

Please sign in to comment.
Something went wrong with that request. Please try again.