test: trim doctor and gateway partial mocks

This commit is contained in:
Peter Steinberger 2026-04-03 18:32:25 +01:00
parent f36ed7105f
commit 68edc53090
No known key found for this signature in database
2 changed files with 26 additions and 17 deletions

View File

@ -207,8 +207,8 @@ vi.mock("../plugins/loader.js", () => ({
loadOpenClawPlugins: () => createEmptyPluginRegistry(),
}));
vi.mock("../config/config.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../config/config.js")>();
vi.mock("../config/config.js", async () => {
const actual = await vi.importActual<typeof import("../config/config.js")>("../config/config.js");
return {
...actual,
CONFIG_PATH: "/tmp/openclaw.json",
@ -249,8 +249,8 @@ vi.mock("./doctor-gateway-auth-token.js", () => ({
resolveGatewayAuthTokenForService,
}));
vi.mock("../gateway/call.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../gateway/call.js")>();
vi.mock("../gateway/call.js", async () => {
const actual = await vi.importActual<typeof import("../gateway/call.js")>("../gateway/call.js");
return {
...actual,
callGateway,
@ -270,8 +270,10 @@ vi.mock("../infra/update-runner.js", () => ({
runGatewayUpdate,
}));
vi.mock("../agents/auth-profiles.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../agents/auth-profiles.js")>();
vi.mock("../agents/auth-profiles.js", async () => {
const actual = await vi.importActual<typeof import("../agents/auth-profiles.js")>(
"../agents/auth-profiles.js",
);
return {
...actual,
ensureAuthProfileStore,
@ -312,8 +314,8 @@ vi.mock("../runtime.js", () => ({
},
}));
vi.mock("../utils.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../utils.js")>();
vi.mock("../utils.js", async () => {
const actual = await vi.importActual<typeof import("../utils.js")>("../utils.js");
return {
...actual,
resolveUserPath: (value: string) => value,

View File

@ -104,8 +104,10 @@ vi.mock("../auto-reply/reply/abort.js", async () => {
};
});
vi.mock("../agents/bootstrap-cache.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../agents/bootstrap-cache.js")>();
vi.mock("../agents/bootstrap-cache.js", async () => {
const actual = await vi.importActual<typeof import("../agents/bootstrap-cache.js")>(
"../agents/bootstrap-cache.js",
);
return {
...actual,
clearBootstrapSnapshot: bootstrapCacheMocks.clearBootstrapSnapshot,
@ -123,8 +125,10 @@ vi.mock("../hooks/internal-hooks.js", async () => {
};
});
vi.mock("../plugins/hook-runner-global.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../plugins/hook-runner-global.js")>();
vi.mock("../plugins/hook-runner-global.js", async () => {
const actual = await vi.importActual<typeof import("../plugins/hook-runner-global.js")>(
"../plugins/hook-runner-global.js",
);
return {
...actual,
getGlobalHookRunner: vi.fn(() => ({
@ -141,9 +145,10 @@ vi.mock("../plugins/hook-runner-global.js", async (importOriginal) => {
};
});
vi.mock("../infra/outbound/session-binding-service.js", async (importOriginal) => {
const actual =
await importOriginal<typeof import("../infra/outbound/session-binding-service.js")>();
vi.mock("../infra/outbound/session-binding-service.js", async () => {
const actual = await vi.importActual<
typeof import("../infra/outbound/session-binding-service.js")
>("../infra/outbound/session-binding-service.js");
return {
...actual,
getSessionBindingService: () => ({
@ -154,8 +159,10 @@ vi.mock("../infra/outbound/session-binding-service.js", async (importOriginal) =
};
});
vi.mock("../acp/runtime/registry.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../acp/runtime/registry.js")>();
vi.mock("../acp/runtime/registry.js", async () => {
const actual = await vi.importActual<typeof import("../acp/runtime/registry.js")>(
"../acp/runtime/registry.js",
);
return {
...actual,
getAcpRuntimeBackend: acpRuntimeMocks.getAcpRuntimeBackend,