![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
thunk-test
Advanced tools
Modular testing for JavaScript. Set up tests as thunks, then execute them with a call.
const assert = require('assert')
const identity = require('./identity')
const ThunkTest = require('thunk-test')
describe('identity', () => {
it('returns whatever was passed to it', ThunkTest('identity', identity)
.case(1, 1)
.case('hey', 'hey')
.case(NaN, result => assert(isNaN(result)))
)
})
// identity
// -- identity
// ✓ identity(1) -> 1
// ✓ identity('hey') -> 'hey'
// ✓ identity(NaN) |> result => assert(isNaN(result))
// ✓ returns whatever was passed to it
ThunkTests are composed of a string descriptor, a function to test, and test cases denoted by .case
and .throws
.
ThunkTest(
'pipe: awesome username generator',
pipe([
string => string.toUpperCase(),
string => `x${string}x`,
string => `X${string}X`,
string => `x${string}x`,
string => `_${string}_`,
]))
.case('deimos', '_xXxDEIMOSxXx_') // objects deep equal, otherwise strict equal
.case('|', result => assert.equal(result, '_xXx|xXx_')) // can supply a callback
.case('?', async result => assert.equal(result, '_xXx?xXx_')) // async ok
.throws(1, new TypeError('string.toUpperCase is not a function'))
.throws(null, (err, arg0) => {
assert.strictEqual(arg0, null)
assert.strictEqual(err.name, 'TypeError')
assert.strictEqual(err.message, 'Cannot read property \'toUpperCase\' of null')
})()
// -- pipe: awesome username generator
// ✓ pipeline('deimos') -> '_xXxDEIMOSxXx_'
// ✓ pipeline('|') -> result => assert.equal(result, '_xXx|xXx_')
// ✓ pipeline(1) throws TypeError: string.toUpperCase is not a function
// ✓ pipeline(null) throws; (err, arg0) => {
// assert.strictEqual(arg0, null)
// assert.strictEqual(err.name, 'TypeError')
// assert.strictEqual(err.message, 'Cannot read property \'toUpperCase\' of null')
// }
// ✓ pipeline('?') -> async result => assert.equal(result, '_xXx?xXx_')
// ✓ pipeline(NaN) throws; async (err, arg0) => {
// assert.strictEqual(arg0, NaN)
// assert.strictEqual(err.name, 'TypeError')
// assert.strictEqual(err.message, 'string.toUpperCase is not a function')
// }
ThunkTest(story string, func function) -> thunkTest ()=>() {
case: (...args, expectedResult)=>this,
throws: (...args, expectedError)=>this,
}
with npm
npm i thunk-test
browser script, global ThunkTest
<script src="https://unpkg.com/thunk-test"></script>
browser module
import ThunkTest from 'https://unpkg.com/thunk-test/es.js'
FAQs
Modular testing for JavaScript
The npm package thunk-test receives a total of 0 weekly downloads. As such, thunk-test popularity was classified as not popular.
We found that thunk-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.