mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-19 20:43:56 +00:00
test: guard core helper assertions
This commit is contained in:
@@ -113,7 +113,6 @@ const createCompactionHandler = () => {
|
||||
}),
|
||||
} as unknown as ExtensionAPI;
|
||||
compactionSafeguardExtension(mockApi);
|
||||
expect(compactionHandler).toBeDefined();
|
||||
if (!compactionHandler) {
|
||||
throw new Error("Expected compaction safeguard to register a handler.");
|
||||
}
|
||||
|
||||
@@ -866,8 +866,10 @@ describe("Tool Search", () => {
|
||||
code: `return await openclaw.tools.call("fake_abort_on_timeout", { value: "wait" });`,
|
||||
}),
|
||||
).rejects.toThrow("tool_search_code timed out");
|
||||
expect(observedSignal).toBeDefined();
|
||||
expect(observedSignal?.aborted).toBe(true);
|
||||
if (!observedSignal) {
|
||||
throw new Error("Expected observed abort signal");
|
||||
}
|
||||
expect(observedSignal.aborted).toBe(true);
|
||||
expect(abortCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,7 +24,9 @@ vi.mock("../../config/config.js", () => {
|
||||
const { skillsHandlers } = await import("./skills.js");
|
||||
|
||||
function expectWrittenSkillEntry(skillKey: string, entry: unknown) {
|
||||
expect(writtenConfig).toBeDefined();
|
||||
if (!writtenConfig) {
|
||||
throw new Error("Expected written config");
|
||||
}
|
||||
const config = writtenConfig as {
|
||||
skills?: {
|
||||
entries?: Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user