2022-04-08 07:28:09 +00:00
|
|
|
import { run, exportToString } from '../src/js/index';
|
2022-01-29 23:56:44 +00:00
|
|
|
|
2022-04-08 07:28:09 +00:00
|
|
|
let testRun = (expression: string): string => exportToString(run(expression)[0])
|
|
|
|
|
|
|
|
let runTest = (expression: string, expected: string) => test(expression, () => expect(testRun(expression)).toEqual(expected))
|
|
|
|
|
|
|
|
let runErrorTest = (expression: string, expected: string) => test(`${expression} will error`, () => expect(() => testRun(expression)).toThrowError(expected))
|
2022-03-22 02:33:28 +00:00
|
|
|
|
2022-03-23 02:12:20 +00:00
|
|
|
describe("Simple calculations and results", () => {
|
2022-04-08 07:28:09 +00:00
|
|
|
runTest("mean(normal(5,2))", "5")
|
|
|
|
runTest("10 + 10", "20")
|
2022-03-23 02:12:20 +00:00
|
|
|
})
|
2022-04-08 07:28:09 +00:00
|
|
|
|
2022-03-23 02:12:20 +00:00
|
|
|
describe("Log function", () => {
|
2022-04-08 07:28:09 +00:00
|
|
|
runTest("log(1)", "0")
|
2022-03-23 02:12:20 +00:00
|
|
|
})
|