thunk-test
Advanced tools
Comparing version 1.0.3 to 1.1.0
52
index.js
@@ -333,14 +333,14 @@ const noop = function () {} | ||
* ```coffeescript [specscript] | ||
* assertEqual(expected any, actual any) -> boolean | ||
* assertEqual(expect any, actual any) -> boolean | ||
* ``` | ||
*/ | ||
const assertEqual = function (expected, actual) { | ||
if (typeof expected == 'object' && typeof actual == 'object') { | ||
if (!isDeepEqual(expected, actual)) { | ||
log('expected', expected) | ||
const assertEqual = function (expect, actual) { | ||
if (typeof expect == 'object' && typeof actual == 'object') { | ||
if (!isDeepEqual(expect, actual)) { | ||
log('expect', expect) | ||
log('actual', actual) | ||
throw AssertionError('not deep equal') | ||
} | ||
} else if (expected !== actual) { | ||
log('expected', expected) | ||
} else if (expect !== actual) { | ||
log('expect', expect) | ||
log('actual', actual) | ||
@@ -401,14 +401,14 @@ throw AssertionError('not strict equal') | ||
* | ||
* errorAssertEqual(expected Error, actual Error) | ||
* errorAssertEqual(expect Error, actual Error) | ||
* ``` | ||
*/ | ||
const errorAssertEqual = function (expected, actual) { | ||
if (actual.name != expected.name) { | ||
const errorAssertEqual = function (expect, actual) { | ||
if (actual.name != expect.name) { | ||
log() | ||
log('-- expect:', expected.name) | ||
log('-- expect:', expect.name) | ||
log('-- actual:', actual.name) | ||
throw AssertionError('error names are different') | ||
} else if (actual.message != expected.message) { | ||
} else if (actual.message != expect.message) { | ||
log() | ||
log('-- expect:', expected.message) | ||
log('-- expect:', expect.message) | ||
log('-- actual:', actual.message) | ||
@@ -634,10 +634,10 @@ throw AssertionError('error messages are different') | ||
case(...args) { | ||
const expected = args.pop(), | ||
const expect = args.pop(), | ||
boundArgs = args.map(arg => typeof arg == 'function' ? arg.bind(this) : arg) | ||
if (typeof expected == 'function') { | ||
if (typeof expect == 'function') { | ||
for (const func of funcs) { | ||
operations.push([ | ||
thunkify4(callPropBinary, func, 'apply', this, boundArgs), | ||
curry4(callPropBinary, expected, 'call', this, __), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} |> ${funcInspect(expected)}`)), | ||
curry4(callPropBinary, expect, 'call', this, __), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} |> ${funcInspect(expect)}`)), | ||
].reduce(funcConcat)) | ||
@@ -649,4 +649,4 @@ } | ||
thunkify4(callPropBinary, func, 'apply', this, boundArgs), | ||
curry2(assertEqual, expected, __), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} -> ${inspect(expected)}`)), | ||
curry2(assertEqual, expect, __), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} -> ${inspect(expect)}`)), | ||
].reduce(funcConcat)) | ||
@@ -659,5 +659,5 @@ } | ||
throws(...args) { | ||
const expected = args.pop(), | ||
const expect = args.pop(), | ||
boundArgs = args.map(arg => typeof arg == 'function' ? arg.bind(this) : arg) | ||
if (typeof expected == 'function') { | ||
if (typeof expect == 'function') { | ||
for (const func of funcs) { | ||
@@ -672,9 +672,9 @@ operations.push(function tryCatching() { | ||
} catch (error) { | ||
const execution = expected(error, ...boundArgs) | ||
const execution = expect(error, ...boundArgs) | ||
if (isPromise(execution)) { | ||
return execution.then(funcConcat( | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} throws; ${funcInspect(expected)}`)), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} throws; ${funcInspect(expect)}`)), | ||
noop)) | ||
} | ||
log(` ✓ ${funcSignature(func, boundArgs)} throws; ${funcInspect(expected)}`) | ||
log(` ✓ ${funcSignature(func, boundArgs)} throws; ${funcInspect(expect)}`) | ||
return undefined | ||
@@ -692,4 +692,4 @@ } | ||
thunkify4(callPropBinary, func, 'apply', this, boundArgs), | ||
expected), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} throws ${errorInspect(expected)}`)), | ||
expect), | ||
tapSync(thunkify1(log, ` ✓ ${funcSignature(func, boundArgs)} throws ${errorInspect(expect)}`)), | ||
)) | ||
@@ -696,0 +696,0 @@ } |
{ | ||
"name": "thunk-test", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Modular testing for JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Richard Tong", |
@@ -1,2 +0,2 @@ | ||
const Test = require('./thunk-test') | ||
const Test = require('.') | ||
const assert = require('assert') | ||
@@ -3,0 +3,0 @@ const rubico = require('rubico') |
44864
6
1393