mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 02:41:07 +00:00
refactor: shrink remaining test seam reach-ins
This commit is contained in:
@@ -1 +1,6 @@
|
||||
export { whatsappOutbound } from "./src/outbound-adapter.js";
|
||||
export { deliverWebReply } from "./src/auto-reply/deliver-reply.js";
|
||||
export {
|
||||
trackBackgroundTask,
|
||||
updateLastRouteInBackground,
|
||||
} from "./src/auto-reply/monitor/last-route.js";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
enrichOllamaModelsWithContext,
|
||||
resolveOllamaApiBase,
|
||||
type OllamaTagModel,
|
||||
} from "../../extensions/ollama/src/provider-models.js";
|
||||
} from "../../extensions/ollama/api.js";
|
||||
import { jsonResponse, requestBodyText, requestUrl } from "../test-helpers/http.js";
|
||||
|
||||
describe("ollama-models", () => {
|
||||
|
||||
@@ -54,7 +54,7 @@ vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../../../../extensions/signal/src/send.js", () => ({
|
||||
vi.mock("../../../../extensions/signal/api.js", () => ({
|
||||
sendMessageSignal: vi.fn(),
|
||||
sendTypingSignal: vi.fn(async () => true),
|
||||
sendReadReceiptSignal: vi.fn(async () => true),
|
||||
@@ -65,19 +65,21 @@ vi.mock("../../../pairing/pairing-store.js", () => ({
|
||||
upsertChannelPairingRequest: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../../../../extensions/whatsapp/src/auto-reply/monitor/last-route.js", () => ({
|
||||
trackBackgroundTask: (tasks: Set<Promise<unknown>>, task: Promise<unknown>) => {
|
||||
tasks.add(task);
|
||||
void task.finally(() => {
|
||||
tasks.delete(task);
|
||||
});
|
||||
},
|
||||
updateLastRouteInBackground: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../../../../extensions/whatsapp/src/auto-reply/deliver-reply.js", () => ({
|
||||
deliverWebReply: vi.fn(async () => {}),
|
||||
}));
|
||||
vi.mock("../../../../extensions/whatsapp/test-api.js", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import("../../../../extensions/whatsapp/test-api.js")>();
|
||||
return {
|
||||
...actual,
|
||||
trackBackgroundTask: (tasks: Set<Promise<unknown>>, task: Promise<unknown>) => {
|
||||
tasks.add(task);
|
||||
void task.finally(() => {
|
||||
tasks.delete(task);
|
||||
});
|
||||
},
|
||||
updateLastRouteInBackground: vi.fn(),
|
||||
deliverWebReply: vi.fn(async () => {}),
|
||||
};
|
||||
});
|
||||
|
||||
const { finalizeInboundContext } = await import("../../../auto-reply/reply/inbound-context.js");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { beforeEach, describe, vi } from "vitest";
|
||||
import { beforeEach, describe } from "vitest";
|
||||
import { __testing as discordThreadBindingTesting } from "../../../../extensions/discord/runtime-api.js";
|
||||
import { feishuThreadBindingTesting } from "../../../../extensions/feishu/api.js";
|
||||
import { resetMatrixThreadBindingsForTests } from "../../../../extensions/matrix/api.js";
|
||||
@@ -25,21 +25,6 @@ import {
|
||||
installSessionBindingContractSuite,
|
||||
} from "./suites.js";
|
||||
|
||||
vi.mock("../../../../extensions/matrix/src/matrix/send.js", async () => {
|
||||
const actual = await vi.importActual<
|
||||
typeof import("../../../../extensions/matrix/src/matrix/send.js")
|
||||
>("../../../../extensions/matrix/src/matrix/send.js");
|
||||
return {
|
||||
...actual,
|
||||
sendMessageMatrix: vi.fn(
|
||||
async (_to: string, _message: string, opts?: { threadId?: string }) => ({
|
||||
messageId: opts?.threadId ? "$reply" : "$root",
|
||||
roomId: "!room:example",
|
||||
}),
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
for (const entry of pluginContractRegistry) {
|
||||
describe(`${entry.id} plugin contract`, () => {
|
||||
installChannelPluginContractSuite({
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
configureOllamaNonInteractive,
|
||||
ensureOllamaModelPulled,
|
||||
promptAndConfigureOllama,
|
||||
} from "../../extensions/ollama/src/setup.js";
|
||||
} from "../../extensions/ollama/api.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { jsonResponse, requestBodyText, requestUrl } from "../test-helpers/http.js";
|
||||
import type { WizardPrompter } from "../wizard/prompts.js";
|
||||
|
||||
Reference in New Issue
Block a user