thunk-test
Advanced tools
Comparing version 0.2.6 to 0.2.7
{ | ||
"name": "thunk-test", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Modular testing for JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Richard Tong", |
@@ -304,5 +304,3 @@ const noop = function () {} | ||
*/ | ||
const argsInspect = args => args.length == 1 | ||
? `${inspect(args[0])}` | ||
: `(${args.map(curry1(inspect, __)).join(', ')})` | ||
const argsInspect = args => `${args.map(curry1(inspect, __)).join(', ')}` | ||
@@ -317,5 +315,15 @@ /** | ||
*/ | ||
const funcInspect = func => `${func.name || 'callback'}(${func.length == 0 ? '' : '...'})` | ||
const funcInspect = func => func.toString() | ||
/** | ||
* @name funcSignature | ||
* | ||
* @synopsis | ||
* ```coffeescript [specscript] | ||
* funcSignature(func function, args Array) -> funcRepresentation string | ||
* ``` | ||
*/ | ||
const funcSignature = (func, args) => `${func.name || 'anonymous'}(${argsInspect(args)})` | ||
/** | ||
* @name errorAssertEqual | ||
@@ -449,3 +457,3 @@ * | ||
expected, | ||
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} -> ${funcInspect(expected)}`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} -> ${funcInspect(expected)}`)), | ||
].reduce(funcConcat)) | ||
@@ -456,3 +464,3 @@ } else { | ||
curry2(assertEqual, expected, __), | ||
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} -> ${inspect(expected)}`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} -> ${inspect(expected)}`)), | ||
].reduce(funcConcat)) | ||
@@ -476,6 +484,6 @@ } | ||
return execution.then(funcConcat( | ||
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} throws ...`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, args)} throws; ${funcInspect(expected)}`)), | ||
noop)) | ||
} | ||
log(` ✓ ${argsInspect(args)} throws ...`) | ||
log(` ✓ ${funcSignature(func, args)} throws; ${funcInspect(expected)}`) | ||
return undefined | ||
@@ -482,0 +490,0 @@ } |
15635
512