mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 11:50:42 +00:00
test: tighten session and skills assertions
This commit is contained in:
@@ -523,7 +523,7 @@ describe("installSessionToolResultGuard", () => {
|
||||
|
||||
const persisted = getPersistedMessages(sm);
|
||||
expect(persisted.map((message) => message.role)).toEqual(["user"]);
|
||||
expect(persisted[0]).toMatchObject({ content: "second" });
|
||||
expect((persisted[0] as { content?: unknown } | undefined)?.content).toBe("second");
|
||||
});
|
||||
|
||||
// When an assistant message with toolCalls is aborted, no synthetic toolResult
|
||||
|
||||
@@ -41,12 +41,8 @@ describe("guardSessionManager transcript updates", () => {
|
||||
} as AgentMessage);
|
||||
|
||||
expect(updates).toHaveLength(1);
|
||||
expect(updates[0]).toMatchObject({
|
||||
sessionFile,
|
||||
sessionKey: "agent:main:worker",
|
||||
message: {
|
||||
role: "assistant",
|
||||
},
|
||||
});
|
||||
expect(updates[0]?.sessionFile).toBe(sessionFile);
|
||||
expect(updates[0]?.sessionKey).toBe("agent:main:worker");
|
||||
expect((updates[0]?.message as { role?: string } | undefined)?.role).toBe("assistant");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -141,12 +141,10 @@ describe("buildWorkspaceSkillStatus", () => {
|
||||
expect(skill.eligible).toBe(false);
|
||||
expect(skill.requirements.bins).toEqual(["fakebin"]);
|
||||
expect(skill.missing.bins).toEqual(["fakebin"]);
|
||||
expect(skill.install[0]).toMatchObject({
|
||||
id: "brew",
|
||||
kind: "brew",
|
||||
label: "Install fakebin",
|
||||
bins: ["fakebin"],
|
||||
});
|
||||
expect(skill.install[0]?.id).toBe("brew");
|
||||
expect(skill.install[0]?.kind).toBe("brew");
|
||||
expect(skill.install[0]?.label).toBe("Install fakebin");
|
||||
expect(skill.install[0]?.bins).toEqual(["fakebin"]);
|
||||
});
|
||||
|
||||
it("respects OS-gated skills", () => {
|
||||
|
||||
@@ -68,13 +68,9 @@ describe("ensureSkillsWatcher", () => {
|
||||
expect(opts.ignored).toBe(refreshModule.shouldIgnoreSkillsWatchPath);
|
||||
expect(opts.depth).toBe(2);
|
||||
const posix = (p: string) => p.replaceAll("\\", "/");
|
||||
expect(targets).toEqual(
|
||||
expect.arrayContaining([
|
||||
posix(path.join("/tmp/workspace", "skills")),
|
||||
posix(path.join("/tmp/workspace", ".agents", "skills")),
|
||||
posix(path.join(os.homedir(), ".agents", "skills")),
|
||||
]),
|
||||
);
|
||||
expect(targets).toContain(posix(path.join("/tmp/workspace", "skills")));
|
||||
expect(targets).toContain(posix(path.join("/tmp/workspace", ".agents", "skills")));
|
||||
expect(targets).toContain(posix(path.join(os.homedir(), ".agents", "skills")));
|
||||
const wildcardTargets = targets.filter((target) => target.includes("*"));
|
||||
expect(wildcardTargets).toStrictEqual([]);
|
||||
const ignored = refreshModule.shouldIgnoreSkillsWatchPath;
|
||||
|
||||
Reference in New Issue
Block a user