mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 16:51:59 +03:00
🧹 [Code Health] Replace generic Error with specific EvalError in tests (#82)
🎯 What: Replaced `throw new Error("test error")` with `throw new EvalError("test error")` in the `sequence error recovery` test case within `src/engine/engine.test.ts`. 💡 Why: `EvalError` is the standard domain error used by the evaluation engine. Throwing a generic `Error` triggers a console warning in the error handling code (which treats it as an unexpected bug), whereas `EvalError` is correctly handled silently as expected evaluation failure, improving the clarity of what kind of error is being tested. ✅ Verification: Ran `npm run test src/engine/engine.test.ts` and the full test suite via `npm run test`, which all completed successfully. ✨ Result: More accurate test setup and adherence to the evaluation engine's specific error handling abstractions. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
parent
7bbe666840
commit
31c8eb86d5
1 changed files with 1 additions and 1 deletions
|
|
@ -218,7 +218,7 @@ 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");
|
||||
throw new EvalError("test error");
|
||||
});
|
||||
expect(calc("throw_err(1) 2 hours")).toBe("2 h");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue