Glen Whitney
a16d6a5ce3
Namely, a README describing the proof-of-concept, a custom selective loader, and some additional tests. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #5
14 lines
505 B
JavaScript
14 lines
505 B
JavaScript
import assert from 'assert'
|
|
import PocomathInstance from '../PocomathInstance.mjs'
|
|
|
|
describe('PocomathInstance', () => {
|
|
it('creates an instance that can define typed-functions', () => {
|
|
const pi = new PocomathInstance('dummy')
|
|
pi.install({'add': {'any,any': [[], (a,b) => a+b]}})
|
|
assert.strictEqual(pi.add(2,2), 4)
|
|
assert.strictEqual(pi.add('Kilroy', 17), 'Kilroy17')
|
|
assert.strictEqual(pi.add(1, undefined), NaN)
|
|
assert.throws(() => pi.add(1), TypeError)
|
|
})
|
|
})
|