test: tighten auto reply cleanup assertions · openclaw/openclaw@ecc7e3c
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,10 @@ import { createTestFollowupRun, writeTestSessionStore } from "./agent-runner.tes
|
12 | 12 | const refreshQueuedFollowupSessionMock = vi.fn(); |
13 | 13 | const errorMock = vi.fn(); |
14 | 14 | |
| 15 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 16 | +await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 17 | +} |
| 18 | + |
15 | 19 | describe("resetReplyRunSession", () => { |
16 | 20 | let rootDir = ""; |
17 | 21 | |
@@ -131,6 +135,6 @@ describe("resetReplyRunSession", () => {
|
131 | 135 | onNewSession: () => {}, |
132 | 136 | }); |
133 | 137 | |
134 | | -await expect(fs.access(oldTranscriptPath)).rejects.toThrow(); |
| 138 | +await expectPathMissing(oldTranscriptPath); |
135 | 139 | }); |
136 | 140 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,6 +30,10 @@ async function readJsonlRecords(filePath: string): Promise<ReplayRecord[]> {
|
30 | 30 | return records; |
31 | 31 | } |
32 | 32 | |
| 33 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 34 | +await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 35 | +} |
| 36 | + |
33 | 37 | describe("replayRecentUserAssistantMessages", () => { |
34 | 38 | let root = ""; |
35 | 39 | beforeEach(async () => { |
@@ -73,7 +77,7 @@ describe("replayRecentUserAssistantMessages", () => {
|
73 | 77 | ).join(""); |
74 | 78 | await fs.writeFile(assistantSource, onlyAssistants, "utf8"); |
75 | 79 | expect(await call(assistantSource, assistantTarget)).toBe(0); |
76 | | -await expect(fs.stat(assistantTarget)).rejects.toThrow(); |
| 80 | +await expectPathMissing(assistantTarget); |
77 | 81 | }); |
78 | 82 | |
79 | 83 | it("skips header for pre-existing targets and aligns the tail to a user turn", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。