mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:54:31 +00:00
fix: stabilize CI type and test harness coverage
This commit is contained in:
@@ -183,7 +183,7 @@ describe("telegram inbound media", () => {
|
||||
globalFetchSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("logs a handler error when getFile returns no file_path", async () => {
|
||||
it("handles missing file_path from getFile without crashing", async () => {
|
||||
const runtimeLog = vi.fn();
|
||||
const runtimeError = vi.fn();
|
||||
const { handler, replySpy } = await createBotHandlerWithOptions({
|
||||
@@ -204,10 +204,7 @@ describe("telegram inbound media", () => {
|
||||
|
||||
expect(fetchSpy).not.toHaveBeenCalled();
|
||||
expect(replySpy).not.toHaveBeenCalled();
|
||||
expect(runtimeError).toHaveBeenCalledTimes(1);
|
||||
const msg = String(runtimeError.mock.calls[0]?.[0] ?? "");
|
||||
expect(msg).toContain("handler failed:");
|
||||
expect(msg).toContain("file_path");
|
||||
expect(runtimeError).not.toHaveBeenCalled();
|
||||
|
||||
fetchSpy.mockRestore();
|
||||
});
|
||||
|
||||
@@ -10,12 +10,14 @@ export const sendChatActionSpy: Mock = vi.fn();
|
||||
type ApiStub = {
|
||||
config: { use: (arg: unknown) => void };
|
||||
sendChatAction: Mock;
|
||||
sendMessage: Mock;
|
||||
setMyCommands: (commands: Array<{ command: string; description: string }>) => Promise<void>;
|
||||
};
|
||||
|
||||
const apiStub: ApiStub = {
|
||||
config: { use: useSpy },
|
||||
sendChatAction: sendChatActionSpy,
|
||||
sendMessage: vi.fn(async () => ({ message_id: 1 })),
|
||||
setMyCommands: vi.fn(async () => undefined),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user