mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 15:42:01 +03:00
[Code Health] Replace generic Error with specific EvalError in tests
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.
This commit is contained in:
parent
c90b369b58
commit
342551ca0d
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