mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 21:31:59 +03:00
test: add coverage for workspace evaluation error cleanup (#105)
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: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
parent
22302b57cc
commit
d166820b28
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