test: tighten session and skills assertions

This commit is contained in:
Peter Steinberger
2026-05-09 14:48:32 +01:00
parent ce09e594cd
commit a168fa9ae6
4 changed files with 11 additions and 21 deletions

View File

@@ -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

View File

@@ -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");
});
});

View File

@@ -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", () => {

View File

@@ -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;