squiggle/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res
2022-07-16 19:50:18 -07:00

28 lines
864 B
Plaintext

open Jest
open Expect
let expectEvalToBeOk = (expr: string) =>
Reducer.evaluate(expr)->Reducer_Helpers.rRemoveDefaultsExternal->E.R.isOk->expect->toBe(true)
let registry = FunctionRegistry_Library.registry
let examples = E.A.to_list(FunctionRegistry_Core.Registry.allExamples(registry))
describe("Fn auto-testing", () => {
testAll("tests of validity", examples, r => {
expectEvalToBeOk(r)
})
// testAll(
// "tests of type",
// E.A.to_list(FunctionRegistry_Core.Registry.allExamplesWithFns(registry)),
// ((fn, example)) => {
// let responseType =
// example
// ->Reducer.evaluate
// ->E.R2.fmap(ReducerInterface_InternalExpressionValue.externalValueToValueType)
// let expectedOutputType = fn.output |> E.O.toExn("")
// expect(responseType)->toEqual(Ok(expectedOutputType))
// },
// )
})