14 lines
459 B
JavaScript
14 lines
459 B
JavaScript
|
import assert from 'assert'
|
||
|
import picomathInstance from '../picomathInstance.js'
|
||
|
|
||
|
describe('picomath core', () => {
|
||
|
it('creates an instance that can define TFs', () => {
|
||
|
const pmath = picomathInstance('pmath')
|
||
|
pmath('add', [() => true, (a,b) => a+b])
|
||
|
assert.strictEqual(pmath.add(2,2), 4)
|
||
|
assert.strictEqual(pmath.add('Kilroy', 17), 'Kilroy17')
|
||
|
assert.strictEqual(pmath.add(1), NaN)
|
||
|
// I guess + never throws!
|
||
|
})
|
||
|
})
|