mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
test: add coverage for workspace evaluation error cleanup
Adds a test to `src/workspace.test.ts` to ensure that when `engine.evaluateDocument` throws an exception, the `this.resolving` set is correctly cleaned up in the `finally` block of `doEvaluate`. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
868a34497b
commit
0cc5fc4f23
1 changed files with 13 additions and 0 deletions
|
|
@ -44,6 +44,19 @@ describe("Workspace exports", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Workspace error handling", () => {
|
||||||
|
it("cleans up the resolving set if evaluation throws an unexpected error", () => {
|
||||||
|
const { ws, engine } = makeWorkspace({
|
||||||
|
a: { title: "A", text: "1 + 1" },
|
||||||
|
});
|
||||||
|
vi.spyOn(engine, "evaluateDocument").mockImplementation(() => {
|
||||||
|
throw new Error("mocked crash");
|
||||||
|
});
|
||||||
|
expect(() => ws.evaluateSheet("a", "1 + 1")).toThrowError("mocked crash");
|
||||||
|
expect((ws as any).resolving.has("a")).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Workspace invalidation", () => {
|
describe("Workspace invalidation", () => {
|
||||||
it("invalidating a sheet also invalidates its dependents, not unrelated sheets", () => {
|
it("invalidating a sheet also invalidates its dependents, not unrelated sheets", () => {
|
||||||
const { ws, store } = makeWorkspace({
|
const { ws, store } = makeWorkspace({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue