From 1067cba4d9b1d2e730d103de799b9f06c330cfee Mon Sep 17 00:00:00 2001 From: "dayuan.jiang" Date: Sat, 10 Oct 2026 22:43:05 +0900 Subject: [PATCH] test: read the failed edit's output without unsafe optional chaining --- tests/unit/use-diagram-tool-handlers.test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/use-diagram-tool-handlers.test.tsx b/tests/unit/use-diagram-tool-handlers.test.tsx index 7128c03a..57995a9f 100644 --- a/tests/unit/use-diagram-tool-handlers.test.tsx +++ b/tests/unit/use-diagram-tool-handlers.test.tsx @@ -351,10 +351,10 @@ describe("the model's page", () => { await call("edit_diagram", { operations: [{ operation: "delete", cell_id: "missing" }], }) - const { state, errorText } = addToolOutput.mock.lastCall?.[0] - expect(state).toBe("output-error") - expect(errorText).toContain('id="B"') - expect(errorText).not.toContain('id="A"') + const output = addToolOutput.mock.lastCall?.[0] + expect(output?.state).toBe("output-error") + expect(output?.errorText).toContain('id="B"') + expect(output?.errorText).not.toContain('id="A"') }) it("draws on the first page when the page is not known", async () => {