mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 23:22:32 +00:00
chore: enable redundant type constituent checks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import fs from "node:fs/promises";
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createMockServerResponse } from "../../../test/helpers/plugins/mock-http-response.js";
|
||||
@@ -196,12 +196,16 @@ describe("diffs plugin registration", () => {
|
||||
type RegisteredTool = {
|
||||
execute?: (toolCallId: string, params: Record<string, unknown>) => Promise<unknown>;
|
||||
};
|
||||
type HttpRouteHandler = (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
) => boolean | Promise<boolean>;
|
||||
type RegisteredHttpRouteParams = Parameters<OpenClawPluginApi["registerHttpRoute"]>[0];
|
||||
|
||||
let registeredToolFactory:
|
||||
| ((ctx: OpenClawPluginToolContext) => RegisteredTool | RegisteredTool[] | null | undefined)
|
||||
| undefined;
|
||||
let registeredHttpRouteHandler: RegisteredHttpRouteParams["handler"] | undefined;
|
||||
let registeredHttpRouteHandler: HttpRouteHandler | undefined;
|
||||
const on = vi.fn();
|
||||
|
||||
const api = createTestPluginApi({
|
||||
@@ -234,7 +238,7 @@ describe("diffs plugin registration", () => {
|
||||
registeredToolFactory = typeof tool === "function" ? tool : () => tool;
|
||||
},
|
||||
registerHttpRoute(params: RegisteredHttpRouteParams) {
|
||||
registeredHttpRouteHandler = params.handler;
|
||||
registeredHttpRouteHandler = params.handler as HttpRouteHandler;
|
||||
},
|
||||
on,
|
||||
});
|
||||
|
||||
@@ -492,7 +492,7 @@ function createToolWithScreenshotter(
|
||||
store: DiffArtifactStore,
|
||||
screenshotter: DiffScreenshotter,
|
||||
defaults = DEFAULT_DIFFS_TOOL_DEFAULTS,
|
||||
context: OpenClawPluginToolContext | undefined = {
|
||||
context: OpenClawPluginToolContext = {
|
||||
agentId: "main",
|
||||
sessionId: "session-123",
|
||||
messageChannel: "discord",
|
||||
|
||||
Reference in New Issue
Block a user