mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
refactor: remove unused test utilities
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
type ModelAuthMockModule = {
|
||||
resolveApiKeyForProvider: (...args: unknown[]) => unknown;
|
||||
requireApiKey: (auth: { apiKey?: string; mode?: string }, provider: string) => string;
|
||||
};
|
||||
|
||||
export function createModelAuthMockModule(): ModelAuthMockModule {
|
||||
return {
|
||||
resolveApiKeyForProvider: vi.fn() as (...args: unknown[]) => unknown,
|
||||
requireApiKey: (auth: { apiKey?: string; mode?: string }, provider: string) => {
|
||||
if (auth?.apiKey) {
|
||||
return auth.apiKey;
|
||||
}
|
||||
throw new Error(`No API key resolved for provider "${provider}" (auth mode: ${auth?.mode}).`);
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { vi } from "vitest";
|
||||
import type * as SessionWriteLockModule from "../agents/session-write-lock.js";
|
||||
|
||||
type SessionWriteLockModuleShape = typeof SessionWriteLockModule;
|
||||
@@ -13,16 +12,3 @@ export async function buildSessionWriteLockModuleMock(
|
||||
acquireSessionWriteLock,
|
||||
};
|
||||
}
|
||||
|
||||
export function resetModulesWithSessionWriteLockDoMock(
|
||||
modulePath: string,
|
||||
acquireSessionWriteLock: SessionWriteLockModuleShape["acquireSessionWriteLock"],
|
||||
): void {
|
||||
vi.resetModules();
|
||||
vi.doMock(modulePath, () =>
|
||||
buildSessionWriteLockModuleMock(
|
||||
() => vi.importActual<SessionWriteLockModuleShape>(modulePath),
|
||||
acquireSessionWriteLock,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user