mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
refactor: trim unused reply test helpers
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
vi.mock("../../config/config.js", async () => {
|
||||
const actual =
|
||||
await vi.importActual<typeof import("../../config/config.js")>("../../config/config.js");
|
||||
return {
|
||||
...actual,
|
||||
getRuntimeConfig: () => ({}),
|
||||
};
|
||||
});
|
||||
|
||||
export function installSubagentsCommandCoreMocks() {}
|
||||
@@ -1,10 +1,8 @@
|
||||
import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures";
|
||||
|
||||
type GetReplyModule = typeof import("./get-reply.js");
|
||||
type ReplyModule = typeof import("../reply.js");
|
||||
|
||||
const cachedGetReplyModulePromises = new Map<string, Promise<GetReplyModule>>();
|
||||
const cachedReplyModulePromises = new Map<string, Promise<ReplyModule>>();
|
||||
|
||||
/**
|
||||
* Default to cached module loads for reply tests.
|
||||
@@ -25,19 +23,3 @@ export async function loadGetReplyModuleForTest(options?: {
|
||||
}
|
||||
return await cached;
|
||||
}
|
||||
|
||||
export async function loadReplyModuleForTest(options?: {
|
||||
cacheKey?: string;
|
||||
fresh?: boolean;
|
||||
}): Promise<ReplyModule> {
|
||||
if (options?.fresh) {
|
||||
return await importFreshModule<ReplyModule>(import.meta.url, "../reply.js");
|
||||
}
|
||||
const cacheKey = options?.cacheKey ?? import.meta.url;
|
||||
let cached = cachedReplyModulePromises.get(cacheKey);
|
||||
if (!cached) {
|
||||
cached = import("../reply.js");
|
||||
cachedReplyModulePromises.set(cacheKey, cached);
|
||||
}
|
||||
return await cached;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user