mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
chore: Fix types in tests 35/N.
This commit is contained in:
@@ -10,8 +10,8 @@ function createStubChild() {
|
||||
child.stdin = new PassThrough() as ChildProcess["stdin"];
|
||||
child.stdout = new PassThrough() as ChildProcess["stdout"];
|
||||
child.stderr = new PassThrough() as ChildProcess["stderr"];
|
||||
child.pid = 1234;
|
||||
child.killed = false;
|
||||
Object.defineProperty(child, "pid", { value: 1234, configurable: true });
|
||||
Object.defineProperty(child, "killed", { value: false, configurable: true, writable: true });
|
||||
child.kill = vi.fn(() => true) as ChildProcess["kill"];
|
||||
queueMicrotask(() => {
|
||||
child.emit("spawn");
|
||||
|
||||
@@ -21,8 +21,8 @@ function createStubChild(pid = 1234) {
|
||||
child.stdin = new PassThrough() as ChildProcess["stdin"];
|
||||
child.stdout = new PassThrough() as ChildProcess["stdout"];
|
||||
child.stderr = new PassThrough() as ChildProcess["stderr"];
|
||||
child.pid = pid;
|
||||
child.killed = false;
|
||||
Object.defineProperty(child, "pid", { value: pid, configurable: true });
|
||||
Object.defineProperty(child, "killed", { value: false, configurable: true, writable: true });
|
||||
const killMock = vi.fn(() => true);
|
||||
child.kill = killMock as ChildProcess["kill"];
|
||||
return { child, killMock };
|
||||
|
||||
@@ -24,7 +24,9 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = getFirstToolParameters(converted);
|
||||
const params = getFirstToolParameters(
|
||||
converted as Parameters<typeof getFirstToolParameters>[0],
|
||||
);
|
||||
|
||||
expect(params.type).toBeUndefined();
|
||||
expect(params.properties).toBeDefined();
|
||||
@@ -64,7 +66,9 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = getFirstToolParameters(converted);
|
||||
const params = getFirstToolParameters(
|
||||
converted as Parameters<typeof getFirstToolParameters>[0],
|
||||
);
|
||||
const properties = asRecord(params.properties);
|
||||
const mode = asRecord(properties.mode);
|
||||
const options = asRecord(properties.options);
|
||||
@@ -105,7 +109,9 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = getFirstToolParameters(converted);
|
||||
const params = getFirstToolParameters(
|
||||
converted as Parameters<typeof getFirstToolParameters>[0],
|
||||
);
|
||||
const config = asRecord(asRecord(params.properties).config);
|
||||
const configProps = asRecord(config.properties);
|
||||
const retries = asRecord(configProps.retries);
|
||||
|
||||
@@ -25,7 +25,7 @@ function stubChannelPlugin(params: {
|
||||
blurb: "test stub",
|
||||
},
|
||||
capabilities: {
|
||||
chatTypes: ["dm", "group"],
|
||||
chatTypes: ["direct", "group"],
|
||||
},
|
||||
security: {},
|
||||
config: {
|
||||
@@ -1244,8 +1244,8 @@ describe("security audit", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.deep?.gateway.ok).toBe(false);
|
||||
expect(res.deep?.gateway.error).toContain("probe boom");
|
||||
expect(res.deep?.gateway?.ok).toBe(false);
|
||||
expect(res.deep?.gateway?.error).toContain("probe boom");
|
||||
expect(res.findings).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ checkId: "gateway.probe_failed", severity: "warn" }),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { SignalReactionMessage } from "./monitor/event-handler.types.js";
|
||||
|
||||
const dispatchMock = vi.fn();
|
||||
const readAllowFromMock = vi.fn();
|
||||
@@ -64,7 +65,7 @@ describe("signal event handler sender prefix", () => {
|
||||
fetchAttachment: async () => null,
|
||||
deliverReplies: async () => undefined,
|
||||
resolveSignalReactionTargets: () => [],
|
||||
isSignalReactionMessage: () => false,
|
||||
isSignalReactionMessage: (_reaction): _reaction is SignalReactionMessage => false,
|
||||
shouldEmitSignalReactionNotification: () => false,
|
||||
buildSignalReactionSystemEventText: () => "",
|
||||
});
|
||||
|
||||
@@ -23,12 +23,14 @@ async function runMonitorWithMocks(
|
||||
}
|
||||
describe("monitorSignalProvider tool results", () => {
|
||||
it("pairs uuid-only senders with a uuid allowlist entry", async () => {
|
||||
const baseChannels = (config.channels ?? {}) as Record<string, unknown>;
|
||||
const baseSignal = (baseChannels.signal ?? {}) as Record<string, unknown>;
|
||||
setSignalToolResultTestConfig({
|
||||
...config,
|
||||
channels: {
|
||||
...config.channels,
|
||||
...baseChannels,
|
||||
signal: {
|
||||
...config.channels?.signal,
|
||||
...baseSignal,
|
||||
autoStart: false,
|
||||
dmPolicy: "pairing",
|
||||
allowFrom: [],
|
||||
|
||||
@@ -717,9 +717,17 @@ describe("registerSlackInteractionEvents", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as {
|
||||
id?: string;
|
||||
callback_id?: string;
|
||||
root_view_id?: string;
|
||||
previous_view_id?: string;
|
||||
external_id?: string;
|
||||
hash?: string;
|
||||
state?: { values: Record<string, unknown> };
|
||||
},
|
||||
},
|
||||
});
|
||||
} as never);
|
||||
|
||||
expect(ack).toHaveBeenCalled();
|
||||
expect(resolveSessionKey).toHaveBeenCalledWith({
|
||||
|
||||
@@ -26,13 +26,10 @@ const loadConfig = getLoadConfigMock();
|
||||
const readChannelAllowFromStore = getReadChannelAllowFromStoreMock();
|
||||
|
||||
function resolveSkillCommands(config: Parameters<typeof listNativeCommandSpecsForConfig>[0]) {
|
||||
return (
|
||||
listSkillCommandsForAgents as unknown as (params: {
|
||||
cfg: typeof config;
|
||||
}) => Parameters<typeof listNativeCommandSpecsForConfig>[1]["skillCommands"]
|
||||
)({
|
||||
cfg: config,
|
||||
});
|
||||
void config;
|
||||
return listSkillCommandsForAgents() as NonNullable<
|
||||
Parameters<typeof listNativeCommandSpecsForConfig>[1]
|
||||
>["skillCommands"];
|
||||
}
|
||||
|
||||
const ORIGINAL_TZ = process.env.TZ;
|
||||
|
||||
Reference in New Issue
Block a user