mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
* setup linting with eslint-config-standard, prettier * [autofix] npm run lint -- --fix with new setup * [manual] fix types/ directory errors * [manual] fix linting errors in test/ directory * [manual] fix single linting error in src/ * revert ts-expect-error comment change * error on .only in mocha tests * fix test description typo * move some short objects to single line * add and gitignore eslintcache * individually suppress ts any * set --max-warnings to 0 * extract matrices to constants * update ts-expect-error comments
28 lines
877 B
JavaScript
28 lines
877 B
JavaScript
import assert from 'assert'
|
|
import { addDependencies, divideDependencies, piDependencies } from '../../src/entry/dependenciesAny.generated.js'
|
|
import { create } from '../../src/core/create.js'
|
|
|
|
describe('dependencies', function () {
|
|
it('should create functions from a collection of dependencies', function () {
|
|
const { add, divide, pi } = create({
|
|
addDependencies,
|
|
divideDependencies,
|
|
piDependencies
|
|
})
|
|
|
|
assert.strictEqual(add(2, 3), 5)
|
|
assert.strictEqual(divide(6, 3), 2)
|
|
assert.strictEqual(pi, Math.PI)
|
|
})
|
|
|
|
it('should create functions with config', function () {
|
|
const config = { number: 'BigNumber' }
|
|
const { pi } = create({
|
|
piDependencies
|
|
}, config)
|
|
|
|
assert.strictEqual(pi.isBigNumber, true)
|
|
assert.strictEqual(pi.toString(), '3.141592653589793238462643383279502884197169399375105820974944592')
|
|
})
|
|
})
|