mirror of
https://github.com/docmost/docmost.git
synced 2026-07-14 01:16:46 +10:00
feat(base-formula): add date and coercion functions, wire registry
This commit is contained in:
@@ -45,8 +45,7 @@ describe("evaluate", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: unskip after Task 15 wires the function registry with round/concat.
|
||||
describe.skip("evaluate with registered functions", () => {
|
||||
describe("evaluate with registered functions", () => {
|
||||
it("invokes registered functions", () => {
|
||||
expect(run('round(1.6)', {})).toBe(2);
|
||||
expect(run('concat("a", "b", "c")', {})).toBe("abc");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// TODO: unskip after Task 15 lands date functions and populates the registry.
|
||||
import { parseRaw, resolve, typecheck, registry } from "@docmost/base-formula/server";
|
||||
import type { FormulaAST } from "@docmost/base-formula/server";
|
||||
|
||||
@@ -9,7 +8,7 @@ const mk = (src: string, propTypes: Record<string, "number" | "string" | "boolea
|
||||
return { ast: resolved.ast, typeMap };
|
||||
};
|
||||
|
||||
describe.skip("typecheck", () => {
|
||||
describe("typecheck", () => {
|
||||
it("infers number for arithmetic", () => {
|
||||
const { ast, typeMap } = mk('prop("Price") * 2', { Price: "number" });
|
||||
expect(typecheck(ast, typeMap, registry).resultType).toBe("number");
|
||||
|
||||
Reference in New Issue
Block a user