thunk-test
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "thunk-test", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Modular testing for JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Richard Tong", |
@@ -23,3 +23,3 @@ # ThunkTest | ||
})() | ||
// pipe: awesome username generator | ||
// -- pipe: awesome username generator | ||
// ✓ pipeline('deimos') -> '_xXxDEIMOSxXx_' | ||
@@ -41,2 +41,12 @@ // ✓ pipeline('|') -> result => assert.equal(result, '_xXx|xXx_') | ||
`ThunkTest` is a function-first testing library. | ||
### Syntax | ||
```coffeescript | ||
ThunkTest(story string, func function) -> thunkTest ()=>() { | ||
case: (...args, expectedResult)=>this, | ||
throws: (...args, expectedError)=>this, | ||
} | ||
``` | ||
# Installation | ||
@@ -43,0 +53,0 @@ with `npm` |
@@ -327,2 +327,14 @@ const noop = function () {} | ||
/** | ||
* @name errorInspect | ||
* | ||
* @synopsis | ||
* ```coffeescript [specscript] | ||
* Error = { name: string, message: string } | ||
* | ||
* errorInspect(error Error) -> funcRepresentation string | ||
* ``` | ||
*/ | ||
const errorInspect = error => `${error.name}('${error.message}')` | ||
/** | ||
* @name errorAssertEqual | ||
@@ -437,3 +449,3 @@ * | ||
return objectAssign(function thunkTest() { | ||
log(name) | ||
log('--', name) | ||
const operationsLength = operations.length, | ||
@@ -457,3 +469,3 @@ promises = [] | ||
expected, | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} -> ${funcInspect(expected)}`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} |> ${funcInspect(expected)}`)), | ||
].reduce(funcConcat)) | ||
@@ -494,3 +506,3 @@ } else { | ||
thunkify2(assertThrows, thunkifyArgs(func, args), expected), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} throws ${expected}`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} throws ${errorInspect(expected)}`)), | ||
)) | ||
@@ -497,0 +509,0 @@ } |
17372
522
65