test: tighten task flow snapshot assertions · openclaw/openclaw@d3e3c96
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -110,11 +110,19 @@ describe("task-flow-registry store runtime", () => {
|
110 | 110 | }); |
111 | 111 | |
112 | 112 | expect(saveSnapshot).toHaveBeenCalled(); |
113 | | -const latestSnapshot = saveSnapshot.mock.calls.at(-1)?.[0] as { |
| 113 | +const latestCall = saveSnapshot.mock.calls.at(-1); |
| 114 | +if (!latestCall) { |
| 115 | +throw new Error("Expected task flow snapshot save call"); |
| 116 | +} |
| 117 | +const latestSnapshot = latestCall[0] as { |
114 | 118 | flows: ReadonlyMap<string, TaskFlowRecord>; |
115 | 119 | }; |
116 | 120 | expect(latestSnapshot.flows.size).toBe(2); |
117 | | -expect(latestSnapshot.flows.get("flow-restored")?.goal).toBe("Restored flow"); |
| 121 | +const restoredFlow = latestSnapshot.flows.get("flow-restored"); |
| 122 | +if (!restoredFlow) { |
| 123 | +throw new Error("Expected restored task flow"); |
| 124 | +} |
| 125 | +expect(restoredFlow.goal).toBe("Restored flow"); |
118 | 126 | }); |
119 | 127 | |
120 | 128 | it("restores persisted wait-state, revision, and cancel intent from sqlite", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。