mathjs/test/generated-code-tests/dependencies.test.js
Chris Chudzicki 13a3d4c198
Linting: StandardJS for src/, test/; Prettier for types/ (#2544)
* 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
2022-04-29 12:04:01 +02:00

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')
})
})