Comparing version 0.9.0 to 0.9.1
{ | ||
"name": "checkers", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Property-based testing for JavaScript via ClojureScript's test.check", | ||
@@ -5,0 +5,0 @@ "main": "checkers.js", |
@@ -5,2 +5,4 @@ # checkers | ||
<img src="https://drive.google.com/uc?id=0BxqNu2E4b85zeWtxZGtOR1doaXM" align="right" /> | ||
Property-based testing for JavaScript via ClojureScript's [test.check](https://github.com/clojure/test.check). | ||
@@ -55,2 +57,7 @@ | ||
* Generator docs | ||
* Sugar for popular testing frameworks | ||
```js | ||
var checking = require('checkers/mocha'), gen = checking.gen; | ||
checking("property", [gen/int], function ...) | ||
``` | ||
* Tutorial | ||
@@ -57,0 +64,0 @@ * Better examples |
/*eslint-env mocha */ | ||
var _ = require('lodash'); | ||
var assert = require('assert'); | ||
@@ -27,2 +28,22 @@ var checkers = require('..'); | ||
}); | ||
it("errors if property is not satisfied", function() { | ||
try { | ||
checkers.forAll([gen.int], function(i) { | ||
return _.isString(i); | ||
}).check(1); | ||
throw new Error("Shouldn't throw"); | ||
} catch(ex) { | ||
assert.notEqual(ex.message, "Shouldn't throw"); | ||
} | ||
}); | ||
it("errors if property checker throws", function() { | ||
try { | ||
checkers.forAll([gen.int], function() { | ||
throw new Error("whoops"); | ||
}).check(1); | ||
throw new Error("Shouldn't throw"); | ||
} catch(ex) { | ||
assert.equal(ex.message, "whoops"); | ||
} | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
17
9884
79
277419