fix(ci): align stale test expectations

This commit is contained in:
Peter Steinberger
2026-04-06 16:47:09 +01:00
parent 87b2a6a16a
commit f2a710ce63
7 changed files with 12 additions and 70 deletions

View File

@@ -126,7 +126,6 @@ describe("amazon-bedrock provider plugin", () => {
repairToolUseResultPairing: true,
validateAnthropicTurns: true,
allowSyntheticToolResults: true,
dropThinkingBlocks: true,
});
});

View File

@@ -75,7 +75,6 @@ describe("anthropic-vertex provider plugin", () => {
repairToolUseResultPairing: true,
validateAnthropicTurns: true,
allowSyntheticToolResults: true,
dropThinkingBlocks: true,
});
});
});

View File

@@ -65,7 +65,6 @@ describe("anthropic provider replay hooks", () => {
repairToolUseResultPairing: true,
validateAnthropicTurns: true,
allowSyntheticToolResults: true,
dropThinkingBlocks: true,
});
});

View File

@@ -200,7 +200,7 @@ describe("createDiscordNativeCommand option wiring", () => {
member: { roles: [] },
},
options: {
getFocused: () => ({ value: "xh" }),
getFocused: () => ({ value: "" }),
},
respond,
client: {},
@@ -209,63 +209,6 @@ describe("createDiscordNativeCommand option wiring", () => {
expect(respond).toHaveBeenCalledWith([]);
});
it("returns autocomplete choices for allowlisted guild channels when commands.allowFrom is not configured", async () => {
const command = createNativeCommand("think", {
cfg: {
channels: {
discord: {
groupPolicy: "allowlist",
guilds: {
"guild-1": {
channels: {
"channel-1": {
enabled: true,
requireMention: false,
},
},
},
},
},
},
} as ReturnType<typeof loadConfig>,
});
const level = requireOption(command, "level");
const autocomplete = readAutocomplete(level);
if (typeof autocomplete !== "function") {
throw new Error("think level option did not wire autocomplete");
}
const respond = vi.fn(async (_choices: unknown[]) => undefined);
await autocomplete({
user: {
id: "allowed-user",
username: "allowed",
globalName: "Allowed",
},
channel: {
type: ChannelType.GuildText,
id: "channel-1",
name: "general",
},
guild: {
id: "guild-1",
},
rawData: {
member: { roles: [] },
},
options: {
getFocused: () => ({ value: "xh" }),
},
respond,
client: {},
} as never);
expect(respond).toHaveBeenCalledWith(
expect.arrayContaining([expect.objectContaining({ value: expect.any(String) })]),
);
expect(respond).not.toHaveBeenCalledWith([]);
});
it("returns no autocomplete choices outside the Discord allowlist when commands.useAccessGroups is false and commands.allowFrom is not configured", async () => {
const command = createNativeCommand("think", {
cfg: {

View File

@@ -7,7 +7,7 @@ import { clearSessionStoreCacheForTest } from "openclaw/plugin-sdk/config-runtim
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { createNoopThreadBindingManager } from "./thread-bindings.js";
type ConversationRuntimeModule = typeof import("openclaw/plugin-sdk/conversation-runtime");
type ConversationRuntimeModule = typeof import("openclaw/plugin-sdk/conversation-binding-runtime");
type ResolveConfiguredBindingRoute = ConversationRuntimeModule["resolveConfiguredBindingRoute"];
type ConfiguredBindingRouteResult = ReturnType<ResolveConfiguredBindingRoute>;
type EnsureConfiguredBindingRouteReady =
@@ -72,19 +72,19 @@ function createConfiguredRouteResult(
};
}
vi.mock("openclaw/plugin-sdk/conversation-runtime", async () => {
vi.mock("openclaw/plugin-sdk/conversation-binding-runtime", async () => {
const { createConfiguredBindingConversationRuntimeModuleMock } =
await import("../test-support/configured-binding-runtime.js");
return await createConfiguredBindingConversationRuntimeModuleMock<
typeof import("openclaw/plugin-sdk/conversation-runtime")
typeof import("openclaw/plugin-sdk/conversation-binding-runtime")
>(
{
ensureConfiguredBindingRouteReadyMock,
resolveConfiguredBindingRouteMock,
},
() =>
vi.importActual<typeof import("openclaw/plugin-sdk/conversation-runtime")>(
"openclaw/plugin-sdk/conversation-runtime",
vi.importActual<typeof import("openclaw/plugin-sdk/conversation-binding-runtime")>(
"openclaw/plugin-sdk/conversation-binding-runtime",
),
);
});

View File

@@ -519,7 +519,7 @@ describe("memory cli", () => {
it("closes manager after index", async () => {
const close = vi.fn(async () => {});
const sync = vi.fn(async () => {});
mockManager({ sync, close });
mockManager({ sync, status: () => makeMemoryStatus(), close });
const log = spyRuntimeLogs(defaultRuntime);
await runMemoryCli(["index"]);
@@ -624,7 +624,7 @@ describe("memory cli", () => {
const sync = vi.fn(async () => {});
await expectCloseFailureAfterCommand({
args: ["index"],
manager: { sync },
manager: { sync, status: () => makeMemoryStatus() },
beforeExpect: () => {
expectCliSync(sync);
},

View File

@@ -16,9 +16,11 @@ function createLogger(): HookRunnerLogger & {
warn: ReturnType<typeof vi.fn>;
error: ReturnType<typeof vi.fn>;
} {
const warn = vi.fn<(message: string) => void>();
const error = vi.fn<(message: string) => void>();
return {
warn: vi.fn(),
error: vi.fn(),
warn,
error,
};
}