mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 23:32:54 +00:00
refactor(test): consolidate doctor health and sandbox fixtures
This commit is contained in:
@@ -31,6 +31,19 @@ import { detectLegacyWorkspaceDirs } from "./doctor-workspace.js";
|
||||
describe("noteMemorySearchHealth", () => {
|
||||
const cfg = {} as OpenClawConfig;
|
||||
|
||||
async function expectNoWarningWithConfiguredRemoteApiKey(provider: string) {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider,
|
||||
local: {},
|
||||
remote: { apiKey: "from-config" },
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg);
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
note.mockReset();
|
||||
resolveDefaultAgentId.mockClear();
|
||||
@@ -40,29 +53,11 @@ describe("noteMemorySearchHealth", () => {
|
||||
});
|
||||
|
||||
it("does not warn when remote apiKey is configured for explicit provider", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "openai",
|
||||
local: {},
|
||||
remote: { apiKey: "from-config" },
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg);
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
await expectNoWarningWithConfiguredRemoteApiKey("openai");
|
||||
});
|
||||
|
||||
it("does not warn in auto mode when remote apiKey is configured", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "auto",
|
||||
local: {},
|
||||
remote: { apiKey: "from-config" },
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg);
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
await expectNoWarningWithConfiguredRemoteApiKey("auto");
|
||||
});
|
||||
|
||||
it("resolves provider auth from the default agent directory", async () => {
|
||||
|
||||
Reference in New Issue
Block a user