mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:19:34 +00:00
test(memory): dedupe model-auth mock setup
This commit is contained in:
13
src/test-utils/model-auth-mock.ts
Normal file
13
src/test-utils/model-auth-mock.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
export function createModelAuthMockModule() {
|
||||
return {
|
||||
resolveApiKeyForProvider: vi.fn(),
|
||||
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}).`);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user