test: add error recovery coverage for sum sequence aggregation

Added a test case in `engine.test.ts` to cover the `try/catch` block within sequence evaluation (`seq`) in `evaluator.ts`. A custom throwing function is temporarily registered in the engine to simulate intermediate node errors during aggregation and verify that the line gracefully recovers.

Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot] 2026-07-29 00:11:04 +00:00
parent f5b1fc038b
commit 0371f60722

View file

@ -215,6 +215,12 @@ describe("numeral systems", () => {
});
describe("variables and document context", () => {
it("sequence error recovery", () => {
eng.addFunction({ id: "throw_err", phrases: "throw_err" }, () => {
throw new Error("test error");
});
expect(calc("throw_err(1) 2 hours")).toBe("2 h");
});
it("assignment and reuse", () => {
expect(calcDoc("x = 5\nx * 2")).toEqual(["5", "10"]);
});