mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
test: remove redundant runner ordering checks
This commit is contained in:
@@ -466,63 +466,6 @@ describe("runEmbeddedPiAgent", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("persists multi-turn user/assistant ordering across runs", async () => {
|
||||
const sessionFile = nextSessionFile();
|
||||
const cfg = makeOpenAiConfig(["mock-1"]);
|
||||
|
||||
await runEmbeddedPiAgent({
|
||||
sessionId: "session:test",
|
||||
sessionKey: testSessionKey,
|
||||
sessionFile,
|
||||
workspaceDir,
|
||||
config: cfg,
|
||||
prompt: "first",
|
||||
provider: "openai",
|
||||
model: "mock-1",
|
||||
timeoutMs: 5_000,
|
||||
agentDir,
|
||||
runId: nextRunId("turn-first"),
|
||||
enqueue: immediateEnqueue,
|
||||
});
|
||||
|
||||
await runEmbeddedPiAgent({
|
||||
sessionId: "session:test",
|
||||
sessionKey: testSessionKey,
|
||||
sessionFile,
|
||||
workspaceDir,
|
||||
config: cfg,
|
||||
prompt: "second",
|
||||
provider: "openai",
|
||||
model: "mock-1",
|
||||
timeoutMs: 5_000,
|
||||
agentDir,
|
||||
runId: nextRunId("turn-second"),
|
||||
enqueue: immediateEnqueue,
|
||||
});
|
||||
|
||||
const messages = await readSessionMessages(sessionFile);
|
||||
const firstUserIndex = messages.findIndex(
|
||||
(message) => message?.role === "user" && textFromContent(message.content) === "first",
|
||||
);
|
||||
const firstAssistantIndex = messages.findIndex(
|
||||
(message, index) => index > firstUserIndex && message?.role === "assistant",
|
||||
);
|
||||
const secondUserIndex = messages.findIndex(
|
||||
(message, index) =>
|
||||
index > firstAssistantIndex &&
|
||||
message?.role === "user" &&
|
||||
textFromContent(message.content) === "second",
|
||||
);
|
||||
const secondAssistantIndex = messages.findIndex(
|
||||
(message, index) => index > secondUserIndex && message?.role === "assistant",
|
||||
);
|
||||
|
||||
expect(firstUserIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(firstAssistantIndex).toBeGreaterThan(firstUserIndex);
|
||||
expect(secondUserIndex).toBeGreaterThan(firstAssistantIndex);
|
||||
expect(secondAssistantIndex).toBeGreaterThan(secondUserIndex);
|
||||
});
|
||||
|
||||
it("repairs orphaned user messages and continues", async () => {
|
||||
const result = await runWithOrphanedSingleUserMessage("orphaned user");
|
||||
|
||||
|
||||
@@ -128,11 +128,14 @@ describe("cli program (nodes media)", () => {
|
||||
.map((l) => l.replace(/^MEDIA:/, ""))
|
||||
.filter(Boolean);
|
||||
expect(mediaPaths).toHaveLength(2);
|
||||
expect(mediaPaths[0]).toContain("openclaw-camera-snap-");
|
||||
expect(mediaPaths[1]).toContain("openclaw-camera-snap-");
|
||||
|
||||
try {
|
||||
for (const p of mediaPaths) {
|
||||
await expect(fs.readFile(p, "utf8")).resolves.toBe("hi");
|
||||
}
|
||||
// Content bytes are covered by single-output camera/file tests; here we
|
||||
// only verify dual snapshot behavior and that both paths were written.
|
||||
await expect(fs.stat(mediaPaths[0])).resolves.toBeTruthy();
|
||||
await expect(fs.stat(mediaPaths[1])).resolves.toBeTruthy();
|
||||
} finally {
|
||||
await Promise.all(mediaPaths.map((p) => fs.unlink(p).catch(() => {})));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user