New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

thunk-test

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thunk-test - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

2

package.json
{
"name": "thunk-test",
"version": "0.0.1",
"version": "0.1.0",
"description": "Modular testing for JavaScript",

@@ -5,0 +5,0 @@ "author": "Richard Tong",

@@ -14,2 +14,5 @@ # thunk-test

thunkTestForAdd()
// adds two values
// ✓ (5, 5) -> 10
// ✓ (abcde, fg) -> callback(...)
```

@@ -7,2 +7,10 @@ const ThunkTest = require('./thunk-test')

const add = (a, b) => a + b
ThunkTest('adds two values', add)
.case(5, 5, 10) // assert.strictEqual(add(5, 5), 10)
.case('abcde', 'fg', result => { // supply your own callback
assert.strictEqual(result, 'abcdefg')
})()
ThunkTest(

@@ -9,0 +17,0 @@ 'pipe: awesome username generator',

@@ -60,2 +60,14 @@ const noop = function () {}

/**
* @name log
*
* @synopsis
* ```coffeescript [specscript]
* log(args ...any) -> ()
* ```
*/
const log = function (...args) {
console.log(...args)
}
/**
* @name AssertionError

@@ -88,4 +100,4 @@ *

if (expected !== actual) {
console.log('expected', expected)
console.log('actual', actual)
log('expected', expected)
log('actual', actual)
throw AssertionError('not strict equal')

@@ -107,10 +119,10 @@ }

if (actual.name != expected.name) {
console.log()
console.log('-- expect:', expected.name)
console.log('-- actual:', actual.name)
log()
log('-- expect:', expected.name)
log('-- actual:', actual.name)
throw AssertionError('error names are different')
} else if (actual.message != expected.message) {
console.log()
console.log('-- expect:', expected.message)
console.log('-- actual:', actual.message)
log()
log('-- expect:', expected.message)
log('-- actual:', actual.message)
throw AssertionError('error messages are different')

@@ -173,6 +185,6 @@ }

return execution.then(funcConcat(
tapSync(thunkify1(console.log, ` ✓ ${argsInspect(args)} throws ...`)),
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} throws ...`)),
noop))
}
console.log(` ✓ ${argsInspect(args)} throws ...`)
log(` ✓ ${argsInspect(args)} throws ...`)
return undefined

@@ -203,3 +215,3 @@ }

*/
const funcInspect = func => `${func.name || 'callback'}()`
const funcInspect = func => `${func.name || 'callback'}(${func.length == 0 ? '' : '...'})`

@@ -230,3 +242,3 @@ /**

return objectAssign(function thunkTest() {
console.log(name)
log(name)
const operationsLength = operations.length,

@@ -250,3 +262,3 @@ promises = []

expected,
tapSync(thunkify1(console.log, ` ✓ ${argsInspect(args)} -> ${funcInspect(expected)}`)),
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} -> ${funcInspect(expected)}`)),
].reduce(funcConcat))

@@ -257,3 +269,3 @@ } else {

curry2(assertStrictEqual, expected, __),
tapSync(thunkify1(console.log, ` ✓ ${argsInspect(args)} -> ${expected}`)),
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} -> ${expected}`)),
].reduce(funcConcat))

@@ -277,6 +289,6 @@ }

return execution.then(funcConcat(
tapSync(thunkify1(console.log, ` ✓ ${argsInspect(args)} throws ...`)),
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} throws ...`)),
noop))
}
console.log(` ✓ ${argsInspect(args)} throws ...`)
log(` ✓ ${argsInspect(args)} throws ...`)
return undefined

@@ -289,3 +301,3 @@ }

thunkify2(assertThrows, thunkifyArgs(func, args), expected),
tapSync(thunkify1(console.log, ` ✓ ${argsInspect(args)} throws ${expected}`)),
tapSync(thunkify1(log, ` ✓ ${argsInspect(args)} throws ${expected}`)),
))

@@ -292,0 +304,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc