test: define session tool records · openclaw/openclaw@23f8c38
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -503,11 +503,13 @@ describe("sessions tools", () => {
|
503 | 503 | lastMessagePreview?: string; |
504 | 504 | }>; |
505 | 505 | }; |
506 | | -expect(details.sessions).toHaveLength(1); |
507 | | -const visible = details.sessions?.[0]; |
508 | | -expect(visible?.key).toBe("agent:main:main"); |
509 | | -expect(visible?.derivedTitle).toBe("Visible project kickoff"); |
510 | | -expect(visible?.lastMessagePreview).toBe("Visible latest reply"); |
| 506 | +expect(details.sessions).toStrictEqual([ |
| 507 | +expect.objectContaining({ |
| 508 | +derivedTitle: "Visible project kickoff", |
| 509 | +key: "agent:main:main", |
| 510 | +lastMessagePreview: "Visible latest reply", |
| 511 | +}), |
| 512 | +]); |
511 | 513 | expect(JSON.stringify(details.sessions)).not.toContain("Hidden"); |
512 | 514 | } finally { |
513 | 515 | fs.rmSync(tmpDir, { recursive: true, force: true }); |
@@ -810,7 +812,12 @@ describe("sessions tools", () => {
|
810 | 812 | |
811 | 813 | const result = await tool.execute("call5", { sessionKey: sessionId }); |
812 | 814 | const details = result.details as { messages?: unknown[] }; |
813 | | -expect(details.messages).toHaveLength(1); |
| 815 | +expect(details.messages).toStrictEqual([ |
| 816 | +{ |
| 817 | +content: [{ text: "ok", type: "text" }], |
| 818 | +role: "assistant", |
| 819 | +}, |
| 820 | +]); |
814 | 821 | const historyCall = callGatewayMock.mock.calls.find( |
815 | 822 | (call) => (call[0] as { method?: string }).method === "chat.history", |
816 | 823 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。